molstar 3.0.0-dev.4 → 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.
- package/LICENSE +20 -20
- package/README.md +187 -187
- package/build/viewer/embedded.html +43 -43
- package/build/viewer/index.html +106 -95
- package/build/viewer/molstar.js +1 -1
- package/lib/apps/docking-viewer/index.d.ts +2 -1
- package/lib/apps/docking-viewer/index.html +36 -36
- package/lib/apps/docking-viewer/index.js +87 -74
- package/lib/apps/viewer/embedded.html +43 -43
- package/lib/apps/viewer/index.d.ts +37 -215
- package/lib/apps/viewer/index.html +106 -95
- package/lib/apps/viewer/index.js +141 -52
- package/lib/cli/cifschema/index.d.ts +1 -1
- package/lib/cli/cifschema/index.js +15 -35
- package/lib/commonjs/apps/docking-viewer/index.d.ts +2 -1
- package/lib/commonjs/apps/docking-viewer/index.js +86 -73
- package/lib/commonjs/apps/viewer/index.d.ts +37 -215
- package/lib/commonjs/apps/viewer/index.js +141 -52
- package/lib/commonjs/cli/cifschema/index.d.ts +1 -1
- package/lib/commonjs/cli/cifschema/index.js +15 -35
- package/lib/commonjs/examples/alpha-orbitals/index.js +3 -4
- package/lib/commonjs/examples/basic-wrapper/index.js +23 -11
- package/lib/commonjs/examples/lighting/index.d.ts +1 -1
- package/lib/commonjs/examples/lighting/index.js +57 -41
- package/lib/commonjs/examples/proteopedia-wrapper/index.js +26 -14
- package/lib/commonjs/extensions/alpha-orbitals/transforms.d.ts +0 -1
- package/lib/commonjs/extensions/alpha-orbitals/transforms.js +1 -14
- package/lib/commonjs/extensions/anvil/behavior.d.ts +4 -0
- package/lib/commonjs/extensions/anvil/representation.d.ts +50 -0
- package/lib/commonjs/extensions/cellpack/representation.d.ts +10 -0
- package/lib/commonjs/extensions/dnatco/confal-pyramids/representation.d.ts +30 -0
- package/lib/commonjs/extensions/geo-export/mesh-exporter.js +4 -4
- package/lib/commonjs/extensions/model-archive/quality-assessment/behavior.d.ts +68 -0
- package/lib/commonjs/extensions/model-archive/quality-assessment/behavior.js +236 -0
- package/lib/commonjs/extensions/model-archive/quality-assessment/color/plddt.d.ts +14 -0
- package/lib/commonjs/extensions/model-archive/quality-assessment/color/plddt.js +125 -0
- package/lib/commonjs/extensions/model-archive/quality-assessment/color/qmean.d.ts +12 -0
- package/lib/commonjs/extensions/model-archive/quality-assessment/color/qmean.js +111 -0
- package/lib/commonjs/extensions/model-archive/quality-assessment/prop.d.ts +28 -0
- package/lib/commonjs/extensions/model-archive/quality-assessment/prop.js +130 -0
- package/lib/commonjs/extensions/mp4-export/controls.d.ts +1 -0
- package/lib/commonjs/extensions/mp4-export/controls.js +9 -7
- package/lib/commonjs/extensions/pdbe/structure-quality-report/prop.js +1 -1
- package/lib/commonjs/extensions/rcsb/assembly-symmetry/behavior.d.ts +6 -2
- package/lib/commonjs/extensions/rcsb/assembly-symmetry/prop.js +1 -1
- package/lib/commonjs/extensions/rcsb/assembly-symmetry/representation.d.ts +10 -0
- package/lib/commonjs/extensions/rcsb/validation-report/prop.js +1 -1
- package/lib/commonjs/extensions/rcsb/validation-report/representation.d.ts +50 -0
- package/lib/commonjs/mol-canvas3d/canvas3d.d.ts +3 -9
- package/lib/commonjs/mol-canvas3d/canvas3d.js +38 -26
- package/lib/commonjs/mol-canvas3d/helper/bounding-sphere-helper.js +3 -2
- package/lib/commonjs/mol-canvas3d/helper/camera-helper.d.ts +4 -0
- package/lib/commonjs/mol-canvas3d/helper/camera-helper.js +2 -2
- package/lib/commonjs/mol-canvas3d/helper/handle-helper.d.ts +4 -0
- package/lib/commonjs/mol-canvas3d/helper/handle-helper.js +2 -2
- package/lib/commonjs/mol-canvas3d/helper/helper.d.ts +2 -0
- package/lib/commonjs/mol-canvas3d/passes/draw.d.ts +13 -1
- package/lib/commonjs/mol-canvas3d/passes/draw.js +16 -15
- package/lib/commonjs/mol-canvas3d/passes/image.d.ts +1 -0
- package/lib/commonjs/mol-canvas3d/passes/image.js +3 -2
- package/lib/commonjs/mol-canvas3d/passes/marking.js +1 -1
- package/lib/commonjs/mol-canvas3d/passes/multi-sample.d.ts +10 -2
- package/lib/commonjs/mol-canvas3d/passes/multi-sample.js +18 -14
- package/lib/commonjs/mol-canvas3d/passes/pick.js +12 -12
- package/lib/commonjs/mol-canvas3d/passes/postprocessing.js +3 -3
- package/lib/commonjs/mol-canvas3d/passes/smaa.js +1 -1
- package/lib/commonjs/mol-geo/geometry/base.d.ts +18 -0
- package/lib/commonjs/mol-geo/geometry/base.js +18 -1
- package/lib/commonjs/mol-geo/geometry/clipping-data.d.ts +1 -3
- package/lib/commonjs/mol-geo/geometry/clipping-data.js +3 -8
- package/lib/commonjs/mol-geo/geometry/color-data.d.ts +1 -1
- package/lib/commonjs/mol-geo/geometry/color-data.js +22 -0
- package/lib/commonjs/mol-geo/geometry/cylinders/cylinders.d.ts +12 -2
- package/lib/commonjs/mol-geo/geometry/cylinders/cylinders.js +2 -2
- package/lib/commonjs/mol-geo/geometry/direct-volume/direct-volume.d.ts +15 -38
- package/lib/commonjs/mol-geo/geometry/direct-volume/direct-volume.js +21 -66
- package/lib/commonjs/mol-geo/geometry/direct-volume/transfer-function.d.ts +2 -4
- package/lib/commonjs/mol-geo/geometry/direct-volume/transfer-function.js +4 -7
- package/lib/commonjs/mol-geo/geometry/image/image.d.ts +10 -0
- package/lib/commonjs/mol-geo/geometry/image/image.js +1 -1
- package/lib/commonjs/mol-geo/geometry/lines/lines.d.ts +11 -0
- package/lib/commonjs/mol-geo/geometry/lines/lines.js +1 -1
- package/lib/commonjs/mol-geo/geometry/marker-data.d.ts +0 -1
- package/lib/commonjs/mol-geo/geometry/marker-data.js +13 -9
- package/lib/commonjs/mol-geo/geometry/mesh/mesh.d.ts +10 -0
- package/lib/commonjs/mol-geo/geometry/mesh/mesh.js +2 -2
- package/lib/commonjs/mol-geo/geometry/points/points.d.ts +11 -1
- package/lib/commonjs/mol-geo/geometry/points/points.js +1 -1
- package/lib/commonjs/mol-geo/geometry/size-data.js +5 -5
- package/lib/commonjs/mol-geo/geometry/spheres/spheres.d.ts +10 -0
- package/lib/commonjs/mol-geo/geometry/spheres/spheres.js +2 -2
- package/lib/commonjs/mol-geo/geometry/text/text.d.ts +10 -0
- package/lib/commonjs/mol-geo/geometry/text/text.js +1 -1
- package/lib/commonjs/mol-geo/geometry/texture-mesh/texture-mesh.d.ts +10 -0
- package/lib/commonjs/mol-geo/geometry/texture-mesh/texture-mesh.js +2 -2
- package/lib/commonjs/mol-gl/compute/histogram-pyramid/sum.js +2 -2
- package/lib/commonjs/mol-gl/compute/marching-cubes/isosurface.d.ts +2 -2
- package/lib/commonjs/mol-gl/compute/marching-cubes/isosurface.js +10 -9
- package/lib/commonjs/mol-gl/render-object.d.ts +2 -1
- package/lib/commonjs/mol-gl/render-object.js +10 -10
- package/lib/commonjs/mol-gl/renderable/cylinders.d.ts +11 -5
- package/lib/commonjs/mol-gl/renderable/cylinders.js +3 -3
- package/lib/commonjs/mol-gl/renderable/direct-volume.d.ts +15 -14
- package/lib/commonjs/mol-gl/renderable/direct-volume.js +3 -3
- package/lib/commonjs/mol-gl/renderable/image.d.ts +10 -4
- package/lib/commonjs/mol-gl/renderable/image.js +2 -2
- package/lib/commonjs/mol-gl/renderable/lines.d.ts +39 -33
- package/lib/commonjs/mol-gl/renderable/lines.js +3 -3
- package/lib/commonjs/mol-gl/renderable/mesh.d.ts +11 -5
- package/lib/commonjs/mol-gl/renderable/mesh.js +3 -3
- package/lib/commonjs/mol-gl/renderable/points.d.ts +10 -4
- package/lib/commonjs/mol-gl/renderable/points.js +2 -2
- package/lib/commonjs/mol-gl/renderable/schema.d.ts +10 -11
- package/lib/commonjs/mol-gl/renderable/schema.js +4 -10
- package/lib/commonjs/mol-gl/renderable/spheres.d.ts +11 -5
- package/lib/commonjs/mol-gl/renderable/spheres.js +3 -3
- package/lib/commonjs/mol-gl/renderable/text.d.ts +10 -4
- package/lib/commonjs/mol-gl/renderable/text.js +2 -2
- package/lib/commonjs/mol-gl/renderable/texture-mesh.d.ts +11 -6
- package/lib/commonjs/mol-gl/renderable/texture-mesh.js +3 -3
- package/lib/commonjs/mol-gl/renderable.d.ts +0 -1
- package/lib/commonjs/mol-gl/renderer.d.ts +12 -12
- package/lib/commonjs/mol-gl/renderer.js +23 -92
- package/lib/commonjs/mol-gl/scene.d.ts +2 -2
- package/lib/commonjs/mol-gl/scene.js +7 -5
- package/lib/commonjs/mol-gl/shader/chunks/apply-light-color.glsl.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/apply-light-color.glsl.js +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/assign-color-varying.glsl.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/assign-color-varying.glsl.js +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/assign-group.glsl.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/assign-group.glsl.js +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/assign-marker-varying.glsl.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/assign-marker-varying.glsl.js +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/assign-material-color.glsl.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/assign-material-color.glsl.js +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/assign-position.glsl.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/assign-position.glsl.js +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/assign-size.glsl.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/assign-size.glsl.js +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/color-frag-params.glsl.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/color-frag-params.glsl.js +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/color-vert-params.glsl.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/color-vert-params.glsl.js +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/common-frag-params.glsl.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/common-frag-params.glsl.js +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/common-vert-params.glsl.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/common-vert-params.glsl.js +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/common.glsl.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/common.glsl.js +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/wboit-write.glsl.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/wboit-write.glsl.js +1 -1
- package/lib/commonjs/mol-gl/shader/compute/color-smoothing/accumulate.vert.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/compute/color-smoothing/accumulate.vert.js +1 -1
- package/lib/commonjs/mol-gl/shader/cylinders.frag.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/cylinders.frag.js +1 -1
- package/lib/commonjs/mol-gl/shader/direct-volume.frag.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/direct-volume.frag.js +1 -1
- package/lib/commonjs/mol-gl/shader/gaussian-density.frag.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/gaussian-density.frag.js +1 -1
- package/lib/commonjs/mol-gl/shader/histogram-pyramid/reduction.frag.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/histogram-pyramid/reduction.frag.js +1 -1
- package/lib/commonjs/mol-gl/shader/image.frag.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/image.frag.js +1 -1
- package/lib/commonjs/mol-gl/shader/marching-cubes/isosurface.frag.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/marching-cubes/isosurface.frag.js +1 -1
- package/lib/commonjs/mol-gl/shader/mesh.frag.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/mesh.frag.js +1 -1
- package/lib/commonjs/mol-gl/shader/mesh.vert.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/mesh.vert.js +1 -1
- package/lib/commonjs/mol-gl/shader/spheres.frag.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/spheres.frag.js +1 -1
- package/lib/commonjs/mol-gl/shader-code.d.ts +3 -1
- package/lib/commonjs/mol-gl/shader-code.js +43 -14
- package/lib/commonjs/mol-gl/webgl/render-item.d.ts +7 -6
- package/lib/commonjs/mol-gl/webgl/render-item.js +10 -8
- package/lib/commonjs/mol-gl/webgl/resources.js +8 -1
- package/lib/commonjs/mol-io/reader/cif/schema/mmcif.d.ts +326 -1
- package/lib/commonjs/mol-io/reader/cif/schema/mmcif.js +326 -1
- package/lib/commonjs/mol-math/geometry/gaussian-density/gpu.js +2 -2
- package/lib/commonjs/mol-math/geometry/symmetry-operator.js +3 -2
- package/lib/commonjs/mol-math/linear-algebra/3d/quat.d.ts +9 -1
- package/lib/commonjs/mol-math/linear-algebra/3d/quat.js +20 -1
- package/lib/commonjs/mol-model/structure/model/model.d.ts +1 -0
- package/lib/commonjs/mol-model/structure/model/model.js +8 -2
- package/lib/commonjs/mol-model/structure/model/properties/atomic/hierarchy.d.ts +6 -1
- package/lib/commonjs/mol-model/structure/model/properties/atomic/hierarchy.js +1 -1
- package/lib/commonjs/mol-model/structure/model/properties/utils/atomic-derived.d.ts +1 -1
- package/lib/commonjs/mol-model/structure/model/properties/utils/atomic-derived.js +4 -1
- package/lib/commonjs/mol-model/structure/model/properties/utils/atomic-index.d.ts +1 -1
- package/lib/commonjs/mol-model/structure/model/properties/utils/atomic-index.js +12 -1
- package/lib/commonjs/mol-model/structure/model/types.js +9 -0
- package/lib/commonjs/mol-model/structure/structure/unit/rings.js +2 -0
- package/lib/commonjs/mol-model-formats/shape/ply.d.ts +20 -0
- package/lib/commonjs/mol-model-props/computed/representations/interactions-inter-unit-cylinder.d.ts +10 -0
- package/lib/commonjs/mol-model-props/computed/representations/interactions-intra-unit-cylinder.d.ts +10 -0
- package/lib/commonjs/mol-model-props/computed/representations/interactions.d.ts +30 -0
- package/lib/commonjs/mol-model-props/integrative/cross-link-restraint/representation.d.ts +40 -0
- package/lib/commonjs/mol-plugin/behavior/dynamic/representation.js +4 -6
- package/lib/commonjs/mol-plugin/behavior/dynamic/selection/structure-focus-representation.d.ts +11 -0
- package/lib/commonjs/mol-plugin/behavior/dynamic/selection/structure-focus-representation.js +3 -1
- package/lib/commonjs/mol-plugin/behavior/dynamic/volume-streaming/model.d.ts +3 -2
- package/lib/commonjs/mol-plugin/commands.d.ts +1 -4
- package/lib/commonjs/mol-plugin/config.d.ts +1 -1
- package/lib/commonjs/mol-plugin/config.js +5 -25
- package/lib/commonjs/mol-plugin/features.d.ts +9 -0
- package/lib/commonjs/mol-plugin/features.js +38 -0
- package/lib/commonjs/mol-plugin/spec.js +1 -0
- package/lib/commonjs/mol-plugin/util/viewport-screenshot.d.ts +12 -0
- package/lib/commonjs/mol-plugin-state/actions/structure.d.ts +7 -1
- package/lib/commonjs/mol-plugin-state/actions/structure.js +150 -72
- package/lib/commonjs/mol-plugin-state/builder/structure/hierarchy-preset.d.ts +5 -355
- package/lib/commonjs/mol-plugin-state/builder/structure/hierarchy-preset.js +13 -8
- package/lib/commonjs/mol-plugin-state/builder/structure/hierarchy.d.ts +1 -71
- package/lib/commonjs/mol-plugin-state/builder/structure/representation-preset.d.ts +4 -4
- package/lib/commonjs/mol-plugin-state/helpers/structure-clipping.d.ts +1 -1
- package/lib/commonjs/mol-plugin-state/helpers/structure-clipping.js +1 -1
- package/lib/commonjs/mol-plugin-state/helpers/structure-selection-query.js +33 -19
- package/lib/commonjs/mol-plugin-state/manager/structure/component.d.ts +13 -1
- package/lib/commonjs/mol-plugin-state/manager/structure/component.js +13 -8
- package/lib/commonjs/mol-plugin-state/manager/structure/selection.js +3 -1
- package/lib/commonjs/mol-plugin-state/transforms/representation.d.ts +32 -0
- package/lib/commonjs/mol-plugin-state/transforms/representation.js +2 -2
- package/lib/commonjs/mol-plugin-ui/index.d.ts +4 -4
- package/lib/commonjs/mol-plugin-ui/index.js +13 -16
- package/lib/commonjs/mol-plugin-ui/plugin.js +1 -1
- package/lib/commonjs/mol-plugin-ui/viewport/simple-settings.js +2 -6
- package/lib/commonjs/mol-repr/shape/loci/angle.d.ts +10 -0
- package/lib/commonjs/mol-repr/shape/loci/common.d.ts +10 -0
- package/lib/commonjs/mol-repr/shape/loci/dihedral.d.ts +10 -0
- package/lib/commonjs/mol-repr/shape/loci/distance.d.ts +10 -0
- package/lib/commonjs/mol-repr/shape/loci/label.d.ts +10 -0
- package/lib/commonjs/mol-repr/shape/loci/orientation.d.ts +10 -0
- package/lib/commonjs/mol-repr/shape/loci/plane.d.ts +10 -0
- package/lib/commonjs/mol-repr/shape/model/unitcell.d.ts +10 -0
- package/lib/commonjs/mol-repr/structure/complex-representation.js +1 -1
- package/lib/commonjs/mol-repr/structure/complex-visual.d.ts +61 -19
- package/lib/commonjs/mol-repr/structure/params.d.ts +81 -19
- package/lib/commonjs/mol-repr/structure/registry.d.ts +141 -19
- package/lib/commonjs/mol-repr/structure/representation/backbone.d.ts +30 -0
- package/lib/commonjs/mol-repr/structure/representation/ball-and-stick.d.ts +30 -0
- package/lib/commonjs/mol-repr/structure/representation/carbohydrate.d.ts +30 -0
- package/lib/commonjs/mol-repr/structure/representation/cartoon.d.ts +30 -0
- package/lib/commonjs/mol-repr/structure/representation/ellipsoid.d.ts +30 -0
- package/lib/commonjs/mol-repr/structure/representation/gaussian-surface.d.ts +30 -0
- package/lib/commonjs/mol-repr/structure/representation/gaussian-surface.js +1 -1
- package/lib/commonjs/mol-repr/structure/representation/gaussian-volume.d.ts +34 -58
- package/lib/commonjs/mol-repr/structure/representation/gaussian-volume.js +2 -7
- package/lib/commonjs/mol-repr/structure/representation/label.d.ts +30 -0
- package/lib/commonjs/mol-repr/structure/representation/label.js +1 -1
- package/lib/commonjs/mol-repr/structure/representation/line.d.ts +30 -0
- package/lib/commonjs/mol-repr/structure/representation/molecular-surface.d.ts +30 -0
- package/lib/commonjs/mol-repr/structure/representation/molecular-surface.js +1 -1
- package/lib/commonjs/mol-repr/structure/representation/orientation.d.ts +30 -0
- package/lib/commonjs/mol-repr/structure/representation/point.d.ts +30 -0
- package/lib/commonjs/mol-repr/structure/representation/putty.d.ts +30 -0
- package/lib/commonjs/mol-repr/structure/representation/spacefill.d.ts +30 -0
- package/lib/commonjs/mol-repr/structure/units-representation.js +1 -1
- package/lib/commonjs/mol-repr/structure/units-visual.d.ts +81 -19
- package/lib/commonjs/mol-repr/structure/visual/bond-inter-unit-cylinder.d.ts +20 -0
- package/lib/commonjs/mol-repr/structure/visual/bond-inter-unit-line.d.ts +10 -0
- package/lib/commonjs/mol-repr/structure/visual/bond-intra-unit-cylinder.d.ts +20 -0
- package/lib/commonjs/mol-repr/structure/visual/bond-intra-unit-cylinder.js +2 -2
- package/lib/commonjs/mol-repr/structure/visual/bond-intra-unit-line.d.ts +10 -0
- package/lib/commonjs/mol-repr/structure/visual/bond-intra-unit-line.js +2 -2
- package/lib/commonjs/mol-repr/structure/visual/carbohydrate-link-cylinder.d.ts +10 -0
- package/lib/commonjs/mol-repr/structure/visual/carbohydrate-symbol-mesh.d.ts +10 -0
- package/lib/commonjs/mol-repr/structure/visual/carbohydrate-terminal-link-cylinder.d.ts +10 -0
- package/lib/commonjs/mol-repr/structure/visual/element-cross.d.ts +10 -0
- package/lib/commonjs/mol-repr/structure/visual/element-point.d.ts +10 -0
- package/lib/commonjs/mol-repr/structure/visual/element-sphere.d.ts +20 -0
- package/lib/commonjs/mol-repr/structure/visual/ellipsoid-mesh.d.ts +10 -0
- package/lib/commonjs/mol-repr/structure/visual/gaussian-density-volume.d.ts +22 -38
- package/lib/commonjs/mol-repr/structure/visual/gaussian-density-volume.js +8 -6
- package/lib/commonjs/mol-repr/structure/visual/gaussian-surface-mesh.d.ts +40 -0
- package/lib/commonjs/mol-repr/structure/visual/gaussian-surface-mesh.js +11 -8
- package/lib/commonjs/mol-repr/structure/visual/gaussian-surface-wireframe.d.ts +10 -0
- package/lib/commonjs/mol-repr/structure/visual/gaussian-surface-wireframe.js +1 -1
- package/lib/commonjs/mol-repr/structure/visual/label-text.d.ts +10 -0
- package/lib/commonjs/mol-repr/structure/visual/label-text.js +1 -2
- package/lib/commonjs/mol-repr/structure/visual/molecular-surface-mesh.d.ts +10 -0
- package/lib/commonjs/mol-repr/structure/visual/molecular-surface-mesh.js +1 -1
- package/lib/commonjs/mol-repr/structure/visual/molecular-surface-wireframe.d.ts +10 -0
- package/lib/commonjs/mol-repr/structure/visual/molecular-surface-wireframe.js +1 -1
- package/lib/commonjs/mol-repr/structure/visual/nucleotide-block-mesh.d.ts +10 -0
- package/lib/commonjs/mol-repr/structure/visual/nucleotide-ring-mesh.d.ts +10 -0
- package/lib/commonjs/mol-repr/structure/visual/orientation-ellipsoid-mesh.d.ts +10 -0
- package/lib/commonjs/mol-repr/structure/visual/polymer-backbone-cylinder.d.ts +20 -0
- package/lib/commonjs/mol-repr/structure/visual/polymer-backbone-sphere.d.ts +20 -0
- package/lib/commonjs/mol-repr/structure/visual/polymer-direction-wedge.d.ts +10 -0
- package/lib/commonjs/mol-repr/structure/visual/polymer-gap-cylinder.d.ts +10 -0
- package/lib/commonjs/mol-repr/structure/visual/polymer-trace-mesh.d.ts +10 -0
- package/lib/commonjs/mol-repr/structure/visual/polymer-trace-mesh.js +1 -1
- package/lib/commonjs/mol-repr/structure/visual/polymer-tube-mesh.d.ts +10 -0
- package/lib/commonjs/mol-repr/structure/visual/util/bond.js +1 -1
- package/lib/commonjs/mol-repr/structure/visual/util/common.d.ts +3 -2
- package/lib/commonjs/mol-repr/structure/visual/util/common.js +2 -5
- package/lib/commonjs/mol-repr/structure/visual/util/gaussian.d.ts +7 -6
- package/lib/commonjs/mol-repr/structure/visual/util/gaussian.js +12 -12
- package/lib/commonjs/mol-repr/structure/visual/util/molecular-surface.d.ts +2 -1
- package/lib/commonjs/mol-repr/structure/visual/util/molecular-surface.js +4 -4
- package/lib/commonjs/mol-repr/visual.js +11 -7
- package/lib/commonjs/mol-repr/volume/direct-volume.d.ts +33 -57
- package/lib/commonjs/mol-repr/volume/direct-volume.js +8 -12
- package/lib/commonjs/mol-repr/volume/isosurface.d.ts +60 -0
- package/lib/commonjs/mol-repr/volume/isosurface.js +11 -2
- package/lib/commonjs/mol-repr/volume/registry.d.ts +31 -19
- package/lib/commonjs/mol-repr/volume/representation.d.ts +10 -0
- package/lib/commonjs/mol-repr/volume/slice.d.ts +30 -0
- package/lib/commonjs/mol-repr/volume/slice.js +2 -2
- package/lib/commonjs/mol-repr/volume/util.js +2 -2
- package/lib/commonjs/mol-script/language/builder.d.ts +0 -1
- package/lib/commonjs/mol-theme/clipping.d.ts +7 -15
- package/lib/commonjs/mol-theme/clipping.js +5 -12
- package/lib/commonjs/mol-theme/color/volume-value.d.ts +17 -0
- package/lib/commonjs/mol-theme/color/volume-value.js +57 -0
- package/lib/commonjs/mol-theme/color.d.ts +3 -0
- package/lib/commonjs/mol-theme/color.js +2 -0
- package/lib/commonjs/mol-util/clip.d.ts +49 -0
- package/lib/commonjs/mol-util/clip.js +97 -0
- package/lib/commonjs/mol-util/number-packing.d.ts +11 -0
- package/lib/commonjs/mol-util/{float-packing.js → number-packing.js} +10 -19
- package/lib/examples/alpha-orbitals/index.html +61 -60
- package/lib/examples/alpha-orbitals/index.js +4 -5
- package/lib/examples/basic-wrapper/index.html +137 -136
- package/lib/examples/basic-wrapper/index.js +24 -12
- package/lib/examples/lighting/index.d.ts +1 -1
- package/lib/examples/lighting/index.html +88 -86
- package/lib/examples/lighting/index.js +58 -42
- package/lib/examples/proteopedia-wrapper/index.html +236 -235
- package/lib/examples/proteopedia-wrapper/index.js +27 -15
- package/lib/extensions/alpha-orbitals/transforms.d.ts +0 -1
- package/lib/extensions/alpha-orbitals/transforms.js +1 -14
- package/lib/extensions/anvil/behavior.d.ts +4 -0
- package/lib/extensions/anvil/representation.d.ts +50 -0
- package/lib/extensions/cellpack/representation.d.ts +10 -0
- package/lib/extensions/dnatco/confal-pyramids/representation.d.ts +30 -0
- package/lib/extensions/geo-export/mesh-exporter.js +4 -4
- package/lib/extensions/model-archive/quality-assessment/behavior.d.ts +68 -0
- package/lib/extensions/model-archive/quality-assessment/behavior.js +233 -0
- package/lib/extensions/model-archive/quality-assessment/color/plddt.d.ts +14 -0
- package/lib/extensions/model-archive/quality-assessment/color/plddt.js +120 -0
- package/lib/extensions/model-archive/quality-assessment/color/qmean.d.ts +12 -0
- package/lib/extensions/model-archive/quality-assessment/color/qmean.js +106 -0
- package/lib/extensions/model-archive/quality-assessment/prop.d.ts +28 -0
- package/lib/extensions/model-archive/quality-assessment/prop.js +127 -0
- package/lib/extensions/mp4-export/controls.d.ts +1 -0
- package/lib/extensions/mp4-export/controls.js +9 -7
- package/lib/extensions/pdbe/structure-quality-report/prop.js +1 -1
- package/lib/extensions/rcsb/assembly-symmetry/behavior.d.ts +6 -2
- package/lib/extensions/rcsb/assembly-symmetry/prop.js +1 -1
- package/lib/extensions/rcsb/assembly-symmetry/representation.d.ts +10 -0
- package/lib/extensions/rcsb/validation-report/prop.js +1 -1
- package/lib/extensions/rcsb/validation-report/representation.d.ts +50 -0
- package/lib/mol-canvas3d/canvas3d.d.ts +3 -9
- package/lib/mol-canvas3d/canvas3d.js +38 -26
- package/lib/mol-canvas3d/helper/bounding-sphere-helper.js +3 -2
- package/lib/mol-canvas3d/helper/camera-helper.d.ts +4 -0
- package/lib/mol-canvas3d/helper/camera-helper.js +2 -2
- package/lib/mol-canvas3d/helper/handle-helper.d.ts +4 -0
- package/lib/mol-canvas3d/helper/handle-helper.js +2 -2
- package/lib/mol-canvas3d/helper/helper.d.ts +2 -0
- package/lib/mol-canvas3d/passes/draw.d.ts +13 -1
- package/lib/mol-canvas3d/passes/draw.js +16 -15
- package/lib/mol-canvas3d/passes/image.d.ts +1 -0
- package/lib/mol-canvas3d/passes/image.js +3 -2
- package/lib/mol-canvas3d/passes/marking.js +1 -1
- package/lib/mol-canvas3d/passes/multi-sample.d.ts +10 -2
- package/lib/mol-canvas3d/passes/multi-sample.js +18 -14
- package/lib/mol-canvas3d/passes/pick.js +11 -11
- package/lib/mol-canvas3d/passes/postprocessing.js +3 -3
- package/lib/mol-canvas3d/passes/smaa.js +1 -1
- package/lib/mol-geo/geometry/base.d.ts +18 -0
- package/lib/mol-geo/geometry/base.js +18 -1
- package/lib/mol-geo/geometry/clipping-data.d.ts +1 -3
- package/lib/mol-geo/geometry/clipping-data.js +3 -8
- package/lib/mol-geo/geometry/color-data.d.ts +1 -1
- package/lib/mol-geo/geometry/color-data.js +22 -0
- package/lib/mol-geo/geometry/cylinders/cylinders.d.ts +12 -2
- package/lib/mol-geo/geometry/cylinders/cylinders.js +2 -2
- package/lib/mol-geo/geometry/direct-volume/direct-volume.d.ts +15 -38
- package/lib/mol-geo/geometry/direct-volume/direct-volume.js +22 -67
- package/lib/mol-geo/geometry/direct-volume/transfer-function.d.ts +2 -4
- package/lib/mol-geo/geometry/direct-volume/transfer-function.js +4 -7
- package/lib/mol-geo/geometry/image/image.d.ts +10 -0
- package/lib/mol-geo/geometry/image/image.js +1 -1
- package/lib/mol-geo/geometry/lines/lines.d.ts +11 -0
- package/lib/mol-geo/geometry/lines/lines.js +1 -1
- package/lib/mol-geo/geometry/marker-data.d.ts +0 -1
- package/lib/mol-geo/geometry/marker-data.js +13 -9
- package/lib/mol-geo/geometry/mesh/mesh.d.ts +10 -0
- package/lib/mol-geo/geometry/mesh/mesh.js +2 -2
- package/lib/mol-geo/geometry/points/points.d.ts +11 -1
- package/lib/mol-geo/geometry/points/points.js +1 -1
- package/lib/mol-geo/geometry/size-data.js +5 -5
- package/lib/mol-geo/geometry/spheres/spheres.d.ts +10 -0
- package/lib/mol-geo/geometry/spheres/spheres.js +2 -2
- package/lib/mol-geo/geometry/text/text.d.ts +10 -0
- package/lib/mol-geo/geometry/text/text.js +1 -1
- package/lib/mol-geo/geometry/texture-mesh/texture-mesh.d.ts +10 -0
- package/lib/mol-geo/geometry/texture-mesh/texture-mesh.js +2 -2
- package/lib/mol-gl/compute/histogram-pyramid/sum.js +2 -2
- package/lib/mol-gl/compute/marching-cubes/isosurface.d.ts +2 -2
- package/lib/mol-gl/compute/marching-cubes/isosurface.js +10 -9
- package/lib/mol-gl/render-object.d.ts +2 -1
- package/lib/mol-gl/render-object.js +10 -10
- package/lib/mol-gl/renderable/cylinders.d.ts +11 -5
- package/lib/mol-gl/renderable/cylinders.js +3 -3
- package/lib/mol-gl/renderable/direct-volume.d.ts +15 -14
- package/lib/mol-gl/renderable/direct-volume.js +3 -3
- package/lib/mol-gl/renderable/image.d.ts +10 -4
- package/lib/mol-gl/renderable/image.js +2 -2
- package/lib/mol-gl/renderable/lines.d.ts +39 -33
- package/lib/mol-gl/renderable/lines.js +4 -4
- package/lib/mol-gl/renderable/mesh.d.ts +11 -5
- package/lib/mol-gl/renderable/mesh.js +3 -3
- package/lib/mol-gl/renderable/points.d.ts +10 -4
- package/lib/mol-gl/renderable/points.js +2 -2
- package/lib/mol-gl/renderable/schema.d.ts +10 -11
- package/lib/mol-gl/renderable/schema.js +4 -10
- package/lib/mol-gl/renderable/spheres.d.ts +11 -5
- package/lib/mol-gl/renderable/spheres.js +3 -3
- package/lib/mol-gl/renderable/text.d.ts +10 -4
- package/lib/mol-gl/renderable/text.js +2 -2
- package/lib/mol-gl/renderable/texture-mesh.d.ts +11 -6
- package/lib/mol-gl/renderable/texture-mesh.js +3 -3
- package/lib/mol-gl/renderable.d.ts +0 -1
- package/lib/mol-gl/renderer.d.ts +12 -12
- package/lib/mol-gl/renderer.js +24 -93
- package/lib/mol-gl/scene.d.ts +2 -2
- package/lib/mol-gl/scene.js +7 -5
- package/lib/mol-gl/shader/chunks/apply-light-color.glsl.d.ts +1 -1
- package/lib/mol-gl/shader/chunks/apply-light-color.glsl.js +1 -1
- package/lib/mol-gl/shader/chunks/assign-color-varying.glsl.d.ts +1 -1
- package/lib/mol-gl/shader/chunks/assign-color-varying.glsl.js +1 -1
- package/lib/mol-gl/shader/chunks/assign-group.glsl.d.ts +1 -1
- package/lib/mol-gl/shader/chunks/assign-group.glsl.js +1 -1
- package/lib/mol-gl/shader/chunks/assign-marker-varying.glsl.d.ts +1 -1
- package/lib/mol-gl/shader/chunks/assign-marker-varying.glsl.js +1 -1
- package/lib/mol-gl/shader/chunks/assign-material-color.glsl.d.ts +1 -1
- package/lib/mol-gl/shader/chunks/assign-material-color.glsl.js +1 -1
- package/lib/mol-gl/shader/chunks/assign-position.glsl.d.ts +1 -1
- package/lib/mol-gl/shader/chunks/assign-position.glsl.js +1 -1
- package/lib/mol-gl/shader/chunks/assign-size.glsl.d.ts +1 -1
- package/lib/mol-gl/shader/chunks/assign-size.glsl.js +1 -1
- package/lib/mol-gl/shader/chunks/color-frag-params.glsl.d.ts +1 -1
- package/lib/mol-gl/shader/chunks/color-frag-params.glsl.js +1 -1
- package/lib/mol-gl/shader/chunks/color-vert-params.glsl.d.ts +1 -1
- package/lib/mol-gl/shader/chunks/color-vert-params.glsl.js +1 -1
- package/lib/mol-gl/shader/chunks/common-frag-params.glsl.d.ts +1 -1
- package/lib/mol-gl/shader/chunks/common-frag-params.glsl.js +1 -1
- package/lib/mol-gl/shader/chunks/common-vert-params.glsl.d.ts +1 -1
- package/lib/mol-gl/shader/chunks/common-vert-params.glsl.js +1 -1
- package/lib/mol-gl/shader/chunks/common.glsl.d.ts +1 -1
- package/lib/mol-gl/shader/chunks/common.glsl.js +1 -1
- package/lib/mol-gl/shader/chunks/wboit-write.glsl.d.ts +1 -1
- package/lib/mol-gl/shader/chunks/wboit-write.glsl.js +1 -1
- package/lib/mol-gl/shader/compute/color-smoothing/accumulate.vert.d.ts +1 -1
- package/lib/mol-gl/shader/compute/color-smoothing/accumulate.vert.js +1 -1
- package/lib/mol-gl/shader/cylinders.frag.d.ts +1 -1
- package/lib/mol-gl/shader/cylinders.frag.js +1 -1
- package/lib/mol-gl/shader/direct-volume.frag.d.ts +1 -1
- package/lib/mol-gl/shader/direct-volume.frag.js +1 -1
- package/lib/mol-gl/shader/gaussian-density.frag.d.ts +1 -1
- package/lib/mol-gl/shader/gaussian-density.frag.js +1 -1
- package/lib/mol-gl/shader/histogram-pyramid/reduction.frag.d.ts +1 -1
- package/lib/mol-gl/shader/histogram-pyramid/reduction.frag.js +1 -1
- package/lib/mol-gl/shader/image.frag.d.ts +1 -1
- package/lib/mol-gl/shader/image.frag.js +1 -1
- package/lib/mol-gl/shader/marching-cubes/isosurface.frag.d.ts +1 -1
- package/lib/mol-gl/shader/marching-cubes/isosurface.frag.js +1 -1
- package/lib/mol-gl/shader/mesh.frag.d.ts +1 -1
- package/lib/mol-gl/shader/mesh.frag.js +1 -1
- package/lib/mol-gl/shader/mesh.vert.d.ts +1 -1
- package/lib/mol-gl/shader/mesh.vert.js +1 -1
- package/lib/mol-gl/shader/spheres.frag.d.ts +1 -1
- package/lib/mol-gl/shader/spheres.frag.js +1 -1
- package/lib/mol-gl/shader-code.d.ts +3 -1
- package/lib/mol-gl/shader-code.js +43 -14
- package/lib/mol-gl/webgl/render-item.d.ts +7 -6
- package/lib/mol-gl/webgl/render-item.js +8 -6
- package/lib/mol-gl/webgl/resources.js +8 -1
- package/lib/mol-io/reader/cif/schema/mmcif.d.ts +326 -1
- package/lib/mol-io/reader/cif/schema/mmcif.js +326 -1
- package/lib/mol-math/geometry/gaussian-density/gpu.js +2 -2
- package/lib/mol-math/geometry/symmetry-operator.js +3 -2
- package/lib/mol-math/linear-algebra/3d/quat.d.ts +9 -1
- package/lib/mol-math/linear-algebra/3d/quat.js +20 -1
- package/lib/mol-model/structure/model/model.d.ts +1 -0
- package/lib/mol-model/structure/model/model.js +8 -2
- package/lib/mol-model/structure/model/properties/atomic/hierarchy.d.ts +6 -1
- package/lib/mol-model/structure/model/properties/atomic/hierarchy.js +1 -1
- package/lib/mol-model/structure/model/properties/utils/atomic-derived.d.ts +1 -1
- package/lib/mol-model/structure/model/properties/utils/atomic-derived.js +5 -2
- package/lib/mol-model/structure/model/properties/utils/atomic-index.d.ts +1 -1
- package/lib/mol-model/structure/model/properties/utils/atomic-index.js +12 -1
- package/lib/mol-model/structure/model/types.js +9 -0
- package/lib/mol-model/structure/structure/unit/rings.js +2 -0
- package/lib/mol-model-formats/shape/ply.d.ts +20 -0
- package/lib/mol-model-props/computed/representations/interactions-inter-unit-cylinder.d.ts +10 -0
- package/lib/mol-model-props/computed/representations/interactions-intra-unit-cylinder.d.ts +10 -0
- package/lib/mol-model-props/computed/representations/interactions.d.ts +30 -0
- package/lib/mol-model-props/integrative/cross-link-restraint/representation.d.ts +40 -0
- package/lib/mol-plugin/behavior/dynamic/representation.js +4 -6
- package/lib/mol-plugin/behavior/dynamic/selection/structure-focus-representation.d.ts +11 -0
- package/lib/mol-plugin/behavior/dynamic/selection/structure-focus-representation.js +3 -1
- package/lib/mol-plugin/behavior/dynamic/volume-streaming/model.d.ts +3 -2
- package/lib/mol-plugin/commands.d.ts +1 -4
- package/lib/mol-plugin/config.d.ts +1 -1
- package/lib/mol-plugin/config.js +4 -23
- package/lib/mol-plugin/features.d.ts +9 -0
- package/lib/mol-plugin/features.js +35 -0
- package/lib/mol-plugin/spec.js +1 -0
- package/lib/mol-plugin/util/viewport-screenshot.d.ts +12 -0
- package/lib/mol-plugin/version.js +2 -2
- package/lib/mol-plugin-state/actions/structure.d.ts +7 -1
- package/lib/mol-plugin-state/actions/structure.js +150 -72
- package/lib/mol-plugin-state/builder/structure/hierarchy-preset.d.ts +5 -355
- package/lib/mol-plugin-state/builder/structure/hierarchy-preset.js +14 -9
- package/lib/mol-plugin-state/builder/structure/hierarchy.d.ts +1 -71
- package/lib/mol-plugin-state/builder/structure/representation-preset.d.ts +4 -4
- package/lib/mol-plugin-state/helpers/structure-clipping.d.ts +1 -1
- package/lib/mol-plugin-state/helpers/structure-clipping.js +1 -1
- package/lib/mol-plugin-state/helpers/structure-selection-query.js +34 -20
- package/lib/mol-plugin-state/manager/structure/component.d.ts +13 -1
- package/lib/mol-plugin-state/manager/structure/component.js +14 -9
- package/lib/mol-plugin-state/manager/structure/selection.js +3 -1
- package/lib/mol-plugin-state/transforms/representation.d.ts +32 -0
- package/lib/mol-plugin-state/transforms/representation.js +2 -2
- package/lib/mol-plugin-ui/index.d.ts +4 -4
- package/lib/mol-plugin-ui/index.js +11 -13
- package/lib/mol-plugin-ui/plugin.js +1 -1
- package/lib/mol-plugin-ui/skin/base/base.scss +32 -32
- package/lib/mol-plugin-ui/skin/base/components/controls-base.scss +333 -333
- package/lib/mol-plugin-ui/skin/base/components/controls.scss +418 -418
- 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 +643 -643
- 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 +127 -127
- 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 +85 -85
- 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 +2 -6
- package/lib/mol-repr/shape/loci/angle.d.ts +10 -0
- package/lib/mol-repr/shape/loci/common.d.ts +10 -0
- package/lib/mol-repr/shape/loci/dihedral.d.ts +10 -0
- package/lib/mol-repr/shape/loci/distance.d.ts +10 -0
- package/lib/mol-repr/shape/loci/label.d.ts +10 -0
- package/lib/mol-repr/shape/loci/orientation.d.ts +10 -0
- package/lib/mol-repr/shape/loci/plane.d.ts +10 -0
- package/lib/mol-repr/shape/model/unitcell.d.ts +10 -0
- package/lib/mol-repr/structure/complex-representation.js +1 -1
- package/lib/mol-repr/structure/complex-visual.d.ts +61 -19
- package/lib/mol-repr/structure/params.d.ts +81 -19
- package/lib/mol-repr/structure/registry.d.ts +141 -19
- package/lib/mol-repr/structure/representation/backbone.d.ts +30 -0
- package/lib/mol-repr/structure/representation/ball-and-stick.d.ts +30 -0
- package/lib/mol-repr/structure/representation/carbohydrate.d.ts +30 -0
- package/lib/mol-repr/structure/representation/cartoon.d.ts +30 -0
- package/lib/mol-repr/structure/representation/ellipsoid.d.ts +30 -0
- package/lib/mol-repr/structure/representation/gaussian-surface.d.ts +30 -0
- package/lib/mol-repr/structure/representation/gaussian-surface.js +1 -1
- package/lib/mol-repr/structure/representation/gaussian-volume.d.ts +34 -58
- package/lib/mol-repr/structure/representation/gaussian-volume.js +2 -7
- package/lib/mol-repr/structure/representation/label.d.ts +30 -0
- package/lib/mol-repr/structure/representation/label.js +1 -1
- package/lib/mol-repr/structure/representation/line.d.ts +30 -0
- package/lib/mol-repr/structure/representation/molecular-surface.d.ts +30 -0
- package/lib/mol-repr/structure/representation/molecular-surface.js +1 -1
- package/lib/mol-repr/structure/representation/orientation.d.ts +30 -0
- package/lib/mol-repr/structure/representation/point.d.ts +30 -0
- package/lib/mol-repr/structure/representation/putty.d.ts +30 -0
- package/lib/mol-repr/structure/representation/spacefill.d.ts +30 -0
- package/lib/mol-repr/structure/units-representation.js +1 -1
- package/lib/mol-repr/structure/units-visual.d.ts +81 -19
- package/lib/mol-repr/structure/visual/bond-inter-unit-cylinder.d.ts +20 -0
- package/lib/mol-repr/structure/visual/bond-inter-unit-line.d.ts +10 -0
- package/lib/mol-repr/structure/visual/bond-intra-unit-cylinder.d.ts +20 -0
- package/lib/mol-repr/structure/visual/bond-intra-unit-cylinder.js +2 -2
- package/lib/mol-repr/structure/visual/bond-intra-unit-line.d.ts +10 -0
- package/lib/mol-repr/structure/visual/bond-intra-unit-line.js +2 -2
- package/lib/mol-repr/structure/visual/carbohydrate-link-cylinder.d.ts +10 -0
- package/lib/mol-repr/structure/visual/carbohydrate-symbol-mesh.d.ts +10 -0
- package/lib/mol-repr/structure/visual/carbohydrate-terminal-link-cylinder.d.ts +10 -0
- package/lib/mol-repr/structure/visual/element-cross.d.ts +10 -0
- package/lib/mol-repr/structure/visual/element-point.d.ts +10 -0
- package/lib/mol-repr/structure/visual/element-sphere.d.ts +20 -0
- package/lib/mol-repr/structure/visual/ellipsoid-mesh.d.ts +10 -0
- package/lib/mol-repr/structure/visual/gaussian-density-volume.d.ts +22 -38
- package/lib/mol-repr/structure/visual/gaussian-density-volume.js +8 -6
- package/lib/mol-repr/structure/visual/gaussian-surface-mesh.d.ts +40 -0
- package/lib/mol-repr/structure/visual/gaussian-surface-mesh.js +11 -8
- package/lib/mol-repr/structure/visual/gaussian-surface-wireframe.d.ts +10 -0
- package/lib/mol-repr/structure/visual/gaussian-surface-wireframe.js +1 -1
- package/lib/mol-repr/structure/visual/label-text.d.ts +10 -0
- package/lib/mol-repr/structure/visual/label-text.js +1 -2
- package/lib/mol-repr/structure/visual/molecular-surface-mesh.d.ts +10 -0
- package/lib/mol-repr/structure/visual/molecular-surface-mesh.js +1 -1
- package/lib/mol-repr/structure/visual/molecular-surface-wireframe.d.ts +10 -0
- package/lib/mol-repr/structure/visual/molecular-surface-wireframe.js +1 -1
- package/lib/mol-repr/structure/visual/nucleotide-block-mesh.d.ts +10 -0
- package/lib/mol-repr/structure/visual/nucleotide-ring-mesh.d.ts +10 -0
- package/lib/mol-repr/structure/visual/orientation-ellipsoid-mesh.d.ts +10 -0
- package/lib/mol-repr/structure/visual/polymer-backbone-cylinder.d.ts +20 -0
- package/lib/mol-repr/structure/visual/polymer-backbone-sphere.d.ts +20 -0
- package/lib/mol-repr/structure/visual/polymer-direction-wedge.d.ts +10 -0
- package/lib/mol-repr/structure/visual/polymer-gap-cylinder.d.ts +10 -0
- package/lib/mol-repr/structure/visual/polymer-trace-mesh.d.ts +10 -0
- package/lib/mol-repr/structure/visual/polymer-trace-mesh.js +1 -1
- package/lib/mol-repr/structure/visual/polymer-tube-mesh.d.ts +10 -0
- package/lib/mol-repr/structure/visual/util/bond.js +1 -1
- package/lib/mol-repr/structure/visual/util/common.d.ts +3 -2
- package/lib/mol-repr/structure/visual/util/common.js +2 -5
- package/lib/mol-repr/structure/visual/util/gaussian.d.ts +7 -6
- package/lib/mol-repr/structure/visual/util/gaussian.js +12 -12
- package/lib/mol-repr/structure/visual/util/molecular-surface.d.ts +2 -1
- package/lib/mol-repr/structure/visual/util/molecular-surface.js +4 -4
- package/lib/mol-repr/visual.js +11 -7
- package/lib/mol-repr/volume/direct-volume.d.ts +33 -57
- package/lib/mol-repr/volume/direct-volume.js +8 -12
- package/lib/mol-repr/volume/isosurface.d.ts +60 -0
- package/lib/mol-repr/volume/isosurface.js +11 -2
- package/lib/mol-repr/volume/registry.d.ts +31 -19
- package/lib/mol-repr/volume/representation.d.ts +10 -0
- package/lib/mol-repr/volume/slice.d.ts +30 -0
- package/lib/mol-repr/volume/slice.js +2 -2
- package/lib/mol-repr/volume/util.js +2 -2
- package/lib/mol-script/language/builder.d.ts +0 -1
- package/lib/mol-theme/clipping.d.ts +7 -15
- package/lib/mol-theme/clipping.js +5 -12
- package/lib/mol-theme/color/volume-value.d.ts +17 -0
- package/lib/mol-theme/color/volume-value.js +52 -0
- package/lib/mol-theme/color.d.ts +3 -0
- package/lib/mol-theme/color.js +2 -0
- package/lib/mol-util/clip.d.ts +49 -0
- package/lib/mol-util/clip.js +93 -0
- package/lib/mol-util/number-packing.d.ts +11 -0
- package/lib/mol-util/{float-packing.js → number-packing.js} +7 -14
- package/package.json +162 -162
- package/lib/commonjs/mol-util/float-packing.d.ts +0 -15
- package/lib/mol-util/float-packing.d.ts +0 -15
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
|
5
5
|
* @author Michael Krone <michael.krone@uni-tuebingen.de>
|
|
6
6
|
*/
|
|
7
|
-
export var 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\n#if defined(dMarkerType_uniform)\n uniform float uMarker;\n#elif defined(dMarkerType_groupInstance)\n uniform vec2 uMarkerTexDim;\n uniform sampler2D tMarker;\n#endif\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;\n\nuniform float uInteriorDarkening;\nuniform bool uInteriorColorFlag;\nuniform vec3 uInteriorColor;\nbool interior;\n\nuniform bool uRenderWboit;\n\nuniform float uNear;\nuniform float uFar;\nuniform float uIsOrtho;\n\nuniform vec3 uCellDim;\nuniform vec3 uCameraPosition;\nuniform mat4 uCartnToUnit;\n\n#if __VERSION__ != 100\n // for webgl1 this is given as a 'define'\n uniform int uMaxSteps;\n#endif\n\n#if defined(dGridTexType_2d)\n precision highp sampler2D;\n uniform sampler2D tGridTex;\n uniform vec3 uGridTexDim;\n#elif defined(dGridTexType_3d)\n precision highp sampler3D;\n uniform sampler3D tGridTex;\n#endif\n\n#if defined(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_pickObject)\n return vec4(encodeFloatRGB(float(uObjectId)), 1.0);\n #elif defined(dRenderVariant_pickInstance)\n return vec4(encodeFloatRGB(vInstance), 1.0);\n #elif defined(dRenderVariant_pickGroup)\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 #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 #ifndef dDoubleSided\n if (interior) {\n prevValue = value;\n pos += step;\n continue;\n }\n #endif\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 #if defined(dMarkerType_uniform)\n float marker = uMarker;\n #elif defined(dMarkerType_groupInstance)\n float 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 #endif\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 #if defined(dMarkerType_uniform)\n float marker = uMarker;\n #elif defined(dMarkerType_groupInstance)\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 float 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 #endif\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 var 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";
|
|
8
8
|
//# sourceMappingURL=direct-volume.frag.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 gaussianDensity_frag = "\nprecision highp float;\n\nvarying vec3 vPosition;\nvarying float vRadiusSqInv;\n#if defined(dCalcType_groupId)\n #if defined(dGridTexType_2d)\n precision highp sampler2D;\n uniform sampler2D tMinDistanceTex;\n uniform vec3 uGridTexDim;\n #elif defined(dGridTexType_3d)\n precision highp sampler3D;\n uniform sampler3D tMinDistanceTex;\n #endif\n varying float vGroup;\n#endif\n\n#include common\n\nuniform vec3 uGridDim;\nuniform vec2 uGridTexScale;\nuniform float uCurrentSlice;\nuniform float uCurrentX;\nuniform float uCurrentY;\nuniform float uAlpha;\nuniform float uResolution;\nuniform float uRadiusFactorInv;\n\nvoid main() {\n vec2 v = gl_FragCoord.xy - vec2(uCurrentX, uCurrentY) - 0.5;\n vec3 fragPos = vec3(v.x, v.y, uCurrentSlice);\n float dist = distance(fragPos, vPosition) * uResolution;\n\n #if defined(dCalcType_density)\n float density = exp(-uAlpha * ((dist * dist) * vRadiusSqInv));\n gl_FragColor.a = density * uRadiusFactorInv;\n #elif defined(dCalcType_minDistance)\n gl_FragColor.a = 1.0 - dist * uRadiusFactorInv;\n #elif defined(dCalcType_groupId)\n #if defined(dGridTexType_2d)\n float minDistance = 1.0 - texture2D(tMinDistanceTex, (gl_FragCoord.xy) / (uGridTexDim.xy / uGridTexScale)).a;\n #elif defined(dGridTexType_3d)\n float minDistance = 1.0 - texelFetch(tMinDistanceTex, ivec3(gl_FragCoord.xy, uCurrentSlice), 0).a;\n #endif\n if (dist * uRadiusFactorInv > minDistance + uResolution * 0.05)\n discard;\n gl_FragColor.rgb =
|
|
7
|
+
export declare const gaussianDensity_frag = "\nprecision highp float;\n\nvarying vec3 vPosition;\nvarying float vRadiusSqInv;\n#if defined(dCalcType_groupId)\n #if defined(dGridTexType_2d)\n precision highp sampler2D;\n uniform sampler2D tMinDistanceTex;\n uniform vec3 uGridTexDim;\n #elif defined(dGridTexType_3d)\n precision highp sampler3D;\n uniform sampler3D tMinDistanceTex;\n #endif\n varying float vGroup;\n#endif\n\n#include common\n\nuniform vec3 uGridDim;\nuniform vec2 uGridTexScale;\nuniform float uCurrentSlice;\nuniform float uCurrentX;\nuniform float uCurrentY;\nuniform float uAlpha;\nuniform float uResolution;\nuniform float uRadiusFactorInv;\n\nvoid main() {\n vec2 v = gl_FragCoord.xy - vec2(uCurrentX, uCurrentY) - 0.5;\n vec3 fragPos = vec3(v.x, v.y, uCurrentSlice);\n float dist = distance(fragPos, vPosition) * uResolution;\n\n #if defined(dCalcType_density)\n float density = exp(-uAlpha * ((dist * dist) * vRadiusSqInv));\n gl_FragColor.a = density * uRadiusFactorInv;\n #elif defined(dCalcType_minDistance)\n gl_FragColor.a = 1.0 - dist * uRadiusFactorInv;\n #elif defined(dCalcType_groupId)\n #if defined(dGridTexType_2d)\n float minDistance = 1.0 - texture2D(tMinDistanceTex, (gl_FragCoord.xy) / (uGridTexDim.xy / uGridTexScale)).a;\n #elif defined(dGridTexType_3d)\n float minDistance = 1.0 - texelFetch(tMinDistanceTex, ivec3(gl_FragCoord.xy, uCurrentSlice), 0).a;\n #endif\n if (dist * uRadiusFactorInv > minDistance + uResolution * 0.05)\n discard;\n gl_FragColor.rgb = packIntToRGB(vGroup);\n #endif\n}\n";
|
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
|
5
5
|
* @author Michael Krone <michael.krone@uni-tuebingen.de>
|
|
6
6
|
*/
|
|
7
|
-
export var gaussianDensity_frag = "\nprecision highp float;\n\nvarying vec3 vPosition;\nvarying float vRadiusSqInv;\n#if defined(dCalcType_groupId)\n #if defined(dGridTexType_2d)\n precision highp sampler2D;\n uniform sampler2D tMinDistanceTex;\n uniform vec3 uGridTexDim;\n #elif defined(dGridTexType_3d)\n precision highp sampler3D;\n uniform sampler3D tMinDistanceTex;\n #endif\n varying float vGroup;\n#endif\n\n#include common\n\nuniform vec3 uGridDim;\nuniform vec2 uGridTexScale;\nuniform float uCurrentSlice;\nuniform float uCurrentX;\nuniform float uCurrentY;\nuniform float uAlpha;\nuniform float uResolution;\nuniform float uRadiusFactorInv;\n\nvoid main() {\n vec2 v = gl_FragCoord.xy - vec2(uCurrentX, uCurrentY) - 0.5;\n vec3 fragPos = vec3(v.x, v.y, uCurrentSlice);\n float dist = distance(fragPos, vPosition) * uResolution;\n\n #if defined(dCalcType_density)\n float density = exp(-uAlpha * ((dist * dist) * vRadiusSqInv));\n gl_FragColor.a = density * uRadiusFactorInv;\n #elif defined(dCalcType_minDistance)\n gl_FragColor.a = 1.0 - dist * uRadiusFactorInv;\n #elif defined(dCalcType_groupId)\n #if defined(dGridTexType_2d)\n float minDistance = 1.0 - texture2D(tMinDistanceTex, (gl_FragCoord.xy) / (uGridTexDim.xy / uGridTexScale)).a;\n #elif defined(dGridTexType_3d)\n float minDistance = 1.0 - texelFetch(tMinDistanceTex, ivec3(gl_FragCoord.xy, uCurrentSlice), 0).a;\n #endif\n if (dist * uRadiusFactorInv > minDistance + uResolution * 0.05)\n discard;\n gl_FragColor.rgb =
|
|
7
|
+
export var gaussianDensity_frag = "\nprecision highp float;\n\nvarying vec3 vPosition;\nvarying float vRadiusSqInv;\n#if defined(dCalcType_groupId)\n #if defined(dGridTexType_2d)\n precision highp sampler2D;\n uniform sampler2D tMinDistanceTex;\n uniform vec3 uGridTexDim;\n #elif defined(dGridTexType_3d)\n precision highp sampler3D;\n uniform sampler3D tMinDistanceTex;\n #endif\n varying float vGroup;\n#endif\n\n#include common\n\nuniform vec3 uGridDim;\nuniform vec2 uGridTexScale;\nuniform float uCurrentSlice;\nuniform float uCurrentX;\nuniform float uCurrentY;\nuniform float uAlpha;\nuniform float uResolution;\nuniform float uRadiusFactorInv;\n\nvoid main() {\n vec2 v = gl_FragCoord.xy - vec2(uCurrentX, uCurrentY) - 0.5;\n vec3 fragPos = vec3(v.x, v.y, uCurrentSlice);\n float dist = distance(fragPos, vPosition) * uResolution;\n\n #if defined(dCalcType_density)\n float density = exp(-uAlpha * ((dist * dist) * vRadiusSqInv));\n gl_FragColor.a = density * uRadiusFactorInv;\n #elif defined(dCalcType_minDistance)\n gl_FragColor.a = 1.0 - dist * uRadiusFactorInv;\n #elif defined(dCalcType_groupId)\n #if defined(dGridTexType_2d)\n float minDistance = 1.0 - texture2D(tMinDistanceTex, (gl_FragCoord.xy) / (uGridTexDim.xy / uGridTexScale)).a;\n #elif defined(dGridTexType_3d)\n float minDistance = 1.0 - texelFetch(tMinDistanceTex, ivec3(gl_FragCoord.xy, uCurrentSlice), 0).a;\n #endif\n if (dist * uRadiusFactorInv > minDistance + uResolution * 0.05)\n discard;\n gl_FragColor.rgb = packIntToRGB(vGroup);\n #endif\n}\n";
|
|
8
8
|
//# sourceMappingURL=gaussian-density.frag.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const reduction_frag = "\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\nuniform sampler2D tInputLevel;\n\n// previous level used to evaluate the new level\n#if __VERSION__ == 100\n uniform sampler2D tPreviousLevel;\n#else\n precision highp isampler2D;\n uniform isampler2D tPreviousLevel;\n#endif\n\n// inverted size of the previous level texture.\nuniform float uSize;\nuniform float uTexSize;\nuniform bool uFirst;\n\n#include common\n\nvoid main(void) {\n float k = 0.5 * uSize;\n vec2 position = floor((gl_FragCoord.xy / uTexSize) / uSize) * uSize;\n\n #if __VERSION__ == 100\n float a, b, c, d;\n\n if (uFirst) {\n a = texture2D(tInputLevel, position).r * 255.0;\n b = texture2D(tInputLevel, position + vec2(k, 0.0)).r * 255.0;\n c = texture2D(tInputLevel, position + vec2(0.0, k)).r * 255.0;\n d = texture2D(tInputLevel, position + vec2(k, k)).r * 255.0;\n } else {\n a =
|
|
1
|
+
export declare const reduction_frag = "\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\nuniform sampler2D tInputLevel;\n\n// previous level used to evaluate the new level\n#if __VERSION__ == 100\n uniform sampler2D tPreviousLevel;\n#else\n precision highp isampler2D;\n uniform isampler2D tPreviousLevel;\n#endif\n\n// inverted size of the previous level texture.\nuniform float uSize;\nuniform float uTexSize;\nuniform bool uFirst;\n\n#include common\n\nvoid main(void) {\n float k = 0.5 * uSize;\n vec2 position = floor((gl_FragCoord.xy / uTexSize) / uSize) * uSize;\n\n #if __VERSION__ == 100\n float a, b, c, d;\n\n if (uFirst) {\n a = texture2D(tInputLevel, position).r * 255.0;\n b = texture2D(tInputLevel, position + vec2(k, 0.0)).r * 255.0;\n c = texture2D(tInputLevel, position + vec2(0.0, k)).r * 255.0;\n d = texture2D(tInputLevel, position + vec2(k, k)).r * 255.0;\n } else {\n a = unpackRGBToInt(texture2D(tPreviousLevel, position).rgb);\n b = unpackRGBToInt(texture2D(tPreviousLevel, position + vec2(k, 0.0)).rgb);\n c = unpackRGBToInt(texture2D(tPreviousLevel, position + vec2(0.0, k)).rgb);\n d = unpackRGBToInt(texture2D(tPreviousLevel, position + vec2(k, k)).rgb);\n }\n gl_FragColor = vec4(packIntToRGB(a + b + c + d), 1.0);\n #else\n int a, b, c, d;\n\n if (uFirst) {\n a = int(texture2D(tInputLevel, position).r * 255.0);\n b = int(texture2D(tInputLevel, position + vec2(k, 0.0)).r * 255.0);\n c = int(texture2D(tInputLevel, position + vec2(0.0, k)).r * 255.0);\n d = int(texture2D(tInputLevel, position + vec2(k, k)).r * 255.0);\n } else {\n a = texture2D(tPreviousLevel, position).r;\n b = texture2D(tPreviousLevel, position + vec2(k, 0.0)).r;\n c = texture2D(tPreviousLevel, position + vec2(0.0, k)).r;\n d = texture2D(tPreviousLevel, position + vec2(k, k)).r;\n }\n gl_FragColor = ivec4(a + b + c + d);\n #endif\n}\n";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export var reduction_frag = "\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\nuniform sampler2D tInputLevel;\n\n// previous level used to evaluate the new level\n#if __VERSION__ == 100\n uniform sampler2D tPreviousLevel;\n#else\n precision highp isampler2D;\n uniform isampler2D tPreviousLevel;\n#endif\n\n// inverted size of the previous level texture.\nuniform float uSize;\nuniform float uTexSize;\nuniform bool uFirst;\n\n#include common\n\nvoid main(void) {\n float k = 0.5 * uSize;\n vec2 position = floor((gl_FragCoord.xy / uTexSize) / uSize) * uSize;\n\n #if __VERSION__ == 100\n float a, b, c, d;\n\n if (uFirst) {\n a = texture2D(tInputLevel, position).r * 255.0;\n b = texture2D(tInputLevel, position + vec2(k, 0.0)).r * 255.0;\n c = texture2D(tInputLevel, position + vec2(0.0, k)).r * 255.0;\n d = texture2D(tInputLevel, position + vec2(k, k)).r * 255.0;\n } else {\n a =
|
|
1
|
+
export var reduction_frag = "\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\nuniform sampler2D tInputLevel;\n\n// previous level used to evaluate the new level\n#if __VERSION__ == 100\n uniform sampler2D tPreviousLevel;\n#else\n precision highp isampler2D;\n uniform isampler2D tPreviousLevel;\n#endif\n\n// inverted size of the previous level texture.\nuniform float uSize;\nuniform float uTexSize;\nuniform bool uFirst;\n\n#include common\n\nvoid main(void) {\n float k = 0.5 * uSize;\n vec2 position = floor((gl_FragCoord.xy / uTexSize) / uSize) * uSize;\n\n #if __VERSION__ == 100\n float a, b, c, d;\n\n if (uFirst) {\n a = texture2D(tInputLevel, position).r * 255.0;\n b = texture2D(tInputLevel, position + vec2(k, 0.0)).r * 255.0;\n c = texture2D(tInputLevel, position + vec2(0.0, k)).r * 255.0;\n d = texture2D(tInputLevel, position + vec2(k, k)).r * 255.0;\n } else {\n a = unpackRGBToInt(texture2D(tPreviousLevel, position).rgb);\n b = unpackRGBToInt(texture2D(tPreviousLevel, position + vec2(k, 0.0)).rgb);\n c = unpackRGBToInt(texture2D(tPreviousLevel, position + vec2(0.0, k)).rgb);\n d = unpackRGBToInt(texture2D(tPreviousLevel, position + vec2(k, k)).rgb);\n }\n gl_FragColor = vec4(packIntToRGB(a + b + c + d), 1.0);\n #else\n int a, b, c, d;\n\n if (uFirst) {\n a = int(texture2D(tInputLevel, position).r * 255.0);\n b = int(texture2D(tInputLevel, position + vec2(k, 0.0)).r * 255.0);\n c = int(texture2D(tInputLevel, position + vec2(0.0, k)).r * 255.0);\n d = int(texture2D(tInputLevel, position + vec2(k, k)).r * 255.0);\n } else {\n a = texture2D(tPreviousLevel, position).r;\n b = texture2D(tPreviousLevel, position + vec2(k, 0.0)).r;\n c = texture2D(tPreviousLevel, position + vec2(0.0, k)).r;\n d = texture2D(tPreviousLevel, position + vec2(k, k)).r;\n }\n gl_FragColor = ivec4(a + b + c + d);\n #endif\n}\n";
|
|
2
2
|
//# sourceMappingURL=reduction.frag.js.map
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
|
5
5
|
*/
|
|
6
|
-
export declare const image_frag = "\nprecision highp float;\nprecision highp int;\n\n#include common\n#include read_from_texture\n#include common_frag_params\n#include common_clip\n\nuniform vec2 uImageTexDim;\nuniform sampler2D tImageTex;\nuniform sampler2D tGroupTex;\n\nuniform vec2 uMarkerTexDim;\nuniform sampler2D tMarker;\n\nvarying vec2 vUv;\nvarying float vInstance;\n\n#if defined(dInterpolation_catmulrom) || defined(dInterpolation_mitchell) || defined(dInterpolation_bspline)\n #define dInterpolation_cubic\n#endif\n\n#if defined(dInterpolation_cubic)\n #if defined(dInterpolation_catmulrom) || defined(dInterpolation_mitchell)\n #if defined(dInterpolation_catmulrom)\n const float B = 0.0;\n const float C = 0.5;\n #elif defined(dInterpolation_mitchell)\n const float B = 0.333;\n const float C = 0.333;\n #endif\n\n float cubicFilter(float x){\n float f = x;\n if (f < 0.0) {\n f = -f;\n }\n if (f < 1.0) {\n return ((12.0 - 9.0 * B - 6.0 * C) * (f * f * f) +\n (-18.0 + 12.0 * B + 6.0 * C) * (f * f) +\n (6.0 - 2.0 * B)) / 6.0;\n }else if (f >= 1.0 && f < 2.0){\n return ((-B - 6.0 * C) * ( f * f * f)\n + (6.0 * B + 30.0 * C) * (f * f) +\n (-(12.0 * B) - 48.0 * C) * f +\n 8.0 * B + 24.0 * C) / 6.0;\n }else{\n return 0.0;\n }\n }\n #elif defined(dInterpolation_bspline)\n float cubicFilter(float x) {\n float f = x;\n if (f < 0.0) {\n f = -f;\n }\n if (f >= 0.0 && f <= 1.0){\n return (2.0 / 3.0) + (0.5) * (f * f * f) - (f * f);\n } else if (f > 1.0 && f <= 2.0) {\n return 1.0 / 6.0 * pow((2.0 - f), 3.0);\n }\n return 1.0;\n }\n #endif\n\n vec4 biCubic(sampler2D tex, vec2 texCoord) {\n vec2 texelSize = 1.0 / uImageTexDim;\n texCoord -= texelSize / 2.0;\n vec4 nSum = vec4(0.0);\n float nDenom = 0.0;\n vec2 cell = fract(texCoord * uImageTexDim);\n for (float m = -1.0; m <= 2.0; ++m) {\n for (float n = -1.0; n <= 2.0; ++n) {\n vec4 vecData = texture2D(tex, texCoord + texelSize * vec2(m, n));\n float c = cubicFilter(m - cell.x) * cubicFilter(-n + cell.y);\n nSum += vecData * c;\n nDenom += c;\n }\n }\n return nSum / nDenom;\n }\n#endif\n\nvoid main() {\n #include clip_pixel\n\n #if defined(dInterpolation_cubic)\n vec4 imageData = biCubic(tImageTex, vUv);\n #else\n vec4 imageData = texture2D(tImageTex, vUv);\n #endif\n imageData.a = clamp(imageData.a, 0.0, 1.0);\n if (imageData.a > 0.9) imageData.a = 1.0;\n\n float fragmentDepth = gl_FragCoord.z;\n bool interior = false;\n\n #if defined(dRenderVariant_pick)\n if (imageData.a < 0.3)\n discard;\n
|
|
6
|
+
export declare const image_frag = "\nprecision highp float;\nprecision highp int;\n\n#include common\n#include read_from_texture\n#include common_frag_params\n#include common_clip\n\nuniform vec2 uImageTexDim;\nuniform sampler2D tImageTex;\nuniform sampler2D tGroupTex;\n\nuniform vec2 uMarkerTexDim;\nuniform sampler2D tMarker;\n\nvarying vec2 vUv;\nvarying float vInstance;\n\n#if defined(dInterpolation_catmulrom) || defined(dInterpolation_mitchell) || defined(dInterpolation_bspline)\n #define dInterpolation_cubic\n#endif\n\n#if defined(dInterpolation_cubic)\n #if defined(dInterpolation_catmulrom) || defined(dInterpolation_mitchell)\n #if defined(dInterpolation_catmulrom)\n const float B = 0.0;\n const float C = 0.5;\n #elif defined(dInterpolation_mitchell)\n const float B = 0.333;\n const float C = 0.333;\n #endif\n\n float cubicFilter(float x){\n float f = x;\n if (f < 0.0) {\n f = -f;\n }\n if (f < 1.0) {\n return ((12.0 - 9.0 * B - 6.0 * C) * (f * f * f) +\n (-18.0 + 12.0 * B + 6.0 * C) * (f * f) +\n (6.0 - 2.0 * B)) / 6.0;\n }else if (f >= 1.0 && f < 2.0){\n return ((-B - 6.0 * C) * ( f * f * f)\n + (6.0 * B + 30.0 * C) * (f * f) +\n (-(12.0 * B) - 48.0 * C) * f +\n 8.0 * B + 24.0 * C) / 6.0;\n }else{\n return 0.0;\n }\n }\n #elif defined(dInterpolation_bspline)\n float cubicFilter(float x) {\n float f = x;\n if (f < 0.0) {\n f = -f;\n }\n if (f >= 0.0 && f <= 1.0){\n return (2.0 / 3.0) + (0.5) * (f * f * f) - (f * f);\n } else if (f > 1.0 && f <= 2.0) {\n return 1.0 / 6.0 * pow((2.0 - f), 3.0);\n }\n return 1.0;\n }\n #endif\n\n vec4 biCubic(sampler2D tex, vec2 texCoord) {\n vec2 texelSize = 1.0 / uImageTexDim;\n texCoord -= texelSize / 2.0;\n vec4 nSum = vec4(0.0);\n float nDenom = 0.0;\n vec2 cell = fract(texCoord * uImageTexDim);\n for (float m = -1.0; m <= 2.0; ++m) {\n for (float n = -1.0; n <= 2.0; ++n) {\n vec4 vecData = texture2D(tex, texCoord + texelSize * vec2(m, n));\n float c = cubicFilter(m - cell.x) * cubicFilter(-n + cell.y);\n nSum += vecData * c;\n nDenom += c;\n }\n }\n return nSum / nDenom;\n }\n#endif\n\nvoid main() {\n #include clip_pixel\n\n #if defined(dInterpolation_cubic)\n vec4 imageData = biCubic(tImageTex, vUv);\n #else\n vec4 imageData = texture2D(tImageTex, vUv);\n #endif\n imageData.a = clamp(imageData.a, 0.0, 1.0);\n if (imageData.a > 0.9) imageData.a = 1.0;\n\n float fragmentDepth = gl_FragCoord.z;\n bool interior = false;\n\n #if defined(dRenderVariant_pick)\n if (imageData.a < 0.3)\n discard;\n if (uPickType == 1) {\n gl_FragColor = vec4(packIntToRGB(float(uObjectId)), 1.0);\n } else if (uPickType == 2) {\n gl_FragColor = vec4(packIntToRGB(vInstance), 1.0);\n } else {\n gl_FragColor = vec4(texture2D(tGroupTex, vUv).rgb, 1.0);\n }\n #elif defined(dRenderVariant_depth)\n if (imageData.a < 0.05)\n discard;\n gl_FragColor = packDepthToRGBA(gl_FragCoord.z);\n #elif defined(dRenderVariant_marking)\n float marker = uMarker;\n if (uMarker == -1.0) {\n float group = unpackRGBToInt(texture2D(tGroupTex, vUv).rgb);\n marker = readFromTexture(tMarker, vInstance * float(uGroupCount) + group, uMarkerTexDim).a;\n marker = floor(marker * 255.0 + 0.5); // rounding required to work on some cards on win\n }\n if (uMarkingType == 1) {\n if (marker > 0.0 || imageData.a < 0.05)\n discard;\n gl_FragColor = packDepthToRGBA(gl_FragCoord.z);\n } else {\n if (marker == 0.0 || imageData.a < 0.05)\n discard;\n float depthTest = 1.0;\n if (uMarkingDepthTest) {\n depthTest = (fragmentDepth >= getDepth(gl_FragCoord.xy / uDrawingBufferSize)) ? 1.0 : 0.0;\n }\n bool isHighlight = intMod(marker, 2.0) > 0.1;\n gl_FragColor = vec4(0.0, depthTest, isHighlight ? 1.0 : 0.0, 1.0);\n }\n #elif defined(dRenderVariant_color)\n if (imageData.a < 0.05)\n discard;\n gl_FragColor = imageData;\n gl_FragColor.a *= uAlpha;\n\n float marker = uMarker;\n if (uMarker == -1.0) {\n float group = unpackRGBToInt(texture2D(tGroupTex, vUv).rgb);\n marker = readFromTexture(tMarker, vInstance * float(uGroupCount) + group, uMarkerTexDim).a;\n marker = floor(marker * 255.0 + 0.5); // rounding required to work on some cards on win\n }\n\n #include apply_marker_color\n #include apply_fog\n #include wboit_write\n #endif\n}\n";
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
|
5
5
|
*/
|
|
6
|
-
export var image_frag = "\nprecision highp float;\nprecision highp int;\n\n#include common\n#include read_from_texture\n#include common_frag_params\n#include common_clip\n\nuniform vec2 uImageTexDim;\nuniform sampler2D tImageTex;\nuniform sampler2D tGroupTex;\n\nuniform vec2 uMarkerTexDim;\nuniform sampler2D tMarker;\n\nvarying vec2 vUv;\nvarying float vInstance;\n\n#if defined(dInterpolation_catmulrom) || defined(dInterpolation_mitchell) || defined(dInterpolation_bspline)\n #define dInterpolation_cubic\n#endif\n\n#if defined(dInterpolation_cubic)\n #if defined(dInterpolation_catmulrom) || defined(dInterpolation_mitchell)\n #if defined(dInterpolation_catmulrom)\n const float B = 0.0;\n const float C = 0.5;\n #elif defined(dInterpolation_mitchell)\n const float B = 0.333;\n const float C = 0.333;\n #endif\n\n float cubicFilter(float x){\n float f = x;\n if (f < 0.0) {\n f = -f;\n }\n if (f < 1.0) {\n return ((12.0 - 9.0 * B - 6.0 * C) * (f * f * f) +\n (-18.0 + 12.0 * B + 6.0 * C) * (f * f) +\n (6.0 - 2.0 * B)) / 6.0;\n }else if (f >= 1.0 && f < 2.0){\n return ((-B - 6.0 * C) * ( f * f * f)\n + (6.0 * B + 30.0 * C) * (f * f) +\n (-(12.0 * B) - 48.0 * C) * f +\n 8.0 * B + 24.0 * C) / 6.0;\n }else{\n return 0.0;\n }\n }\n #elif defined(dInterpolation_bspline)\n float cubicFilter(float x) {\n float f = x;\n if (f < 0.0) {\n f = -f;\n }\n if (f >= 0.0 && f <= 1.0){\n return (2.0 / 3.0) + (0.5) * (f * f * f) - (f * f);\n } else if (f > 1.0 && f <= 2.0) {\n return 1.0 / 6.0 * pow((2.0 - f), 3.0);\n }\n return 1.0;\n }\n #endif\n\n vec4 biCubic(sampler2D tex, vec2 texCoord) {\n vec2 texelSize = 1.0 / uImageTexDim;\n texCoord -= texelSize / 2.0;\n vec4 nSum = vec4(0.0);\n float nDenom = 0.0;\n vec2 cell = fract(texCoord * uImageTexDim);\n for (float m = -1.0; m <= 2.0; ++m) {\n for (float n = -1.0; n <= 2.0; ++n) {\n vec4 vecData = texture2D(tex, texCoord + texelSize * vec2(m, n));\n float c = cubicFilter(m - cell.x) * cubicFilter(-n + cell.y);\n nSum += vecData * c;\n nDenom += c;\n }\n }\n return nSum / nDenom;\n }\n#endif\n\nvoid main() {\n #include clip_pixel\n\n #if defined(dInterpolation_cubic)\n vec4 imageData = biCubic(tImageTex, vUv);\n #else\n vec4 imageData = texture2D(tImageTex, vUv);\n #endif\n imageData.a = clamp(imageData.a, 0.0, 1.0);\n if (imageData.a > 0.9) imageData.a = 1.0;\n\n float fragmentDepth = gl_FragCoord.z;\n bool interior = false;\n\n #if defined(dRenderVariant_pick)\n if (imageData.a < 0.3)\n discard;\n
|
|
6
|
+
export var image_frag = "\nprecision highp float;\nprecision highp int;\n\n#include common\n#include read_from_texture\n#include common_frag_params\n#include common_clip\n\nuniform vec2 uImageTexDim;\nuniform sampler2D tImageTex;\nuniform sampler2D tGroupTex;\n\nuniform vec2 uMarkerTexDim;\nuniform sampler2D tMarker;\n\nvarying vec2 vUv;\nvarying float vInstance;\n\n#if defined(dInterpolation_catmulrom) || defined(dInterpolation_mitchell) || defined(dInterpolation_bspline)\n #define dInterpolation_cubic\n#endif\n\n#if defined(dInterpolation_cubic)\n #if defined(dInterpolation_catmulrom) || defined(dInterpolation_mitchell)\n #if defined(dInterpolation_catmulrom)\n const float B = 0.0;\n const float C = 0.5;\n #elif defined(dInterpolation_mitchell)\n const float B = 0.333;\n const float C = 0.333;\n #endif\n\n float cubicFilter(float x){\n float f = x;\n if (f < 0.0) {\n f = -f;\n }\n if (f < 1.0) {\n return ((12.0 - 9.0 * B - 6.0 * C) * (f * f * f) +\n (-18.0 + 12.0 * B + 6.0 * C) * (f * f) +\n (6.0 - 2.0 * B)) / 6.0;\n }else if (f >= 1.0 && f < 2.0){\n return ((-B - 6.0 * C) * ( f * f * f)\n + (6.0 * B + 30.0 * C) * (f * f) +\n (-(12.0 * B) - 48.0 * C) * f +\n 8.0 * B + 24.0 * C) / 6.0;\n }else{\n return 0.0;\n }\n }\n #elif defined(dInterpolation_bspline)\n float cubicFilter(float x) {\n float f = x;\n if (f < 0.0) {\n f = -f;\n }\n if (f >= 0.0 && f <= 1.0){\n return (2.0 / 3.0) + (0.5) * (f * f * f) - (f * f);\n } else if (f > 1.0 && f <= 2.0) {\n return 1.0 / 6.0 * pow((2.0 - f), 3.0);\n }\n return 1.0;\n }\n #endif\n\n vec4 biCubic(sampler2D tex, vec2 texCoord) {\n vec2 texelSize = 1.0 / uImageTexDim;\n texCoord -= texelSize / 2.0;\n vec4 nSum = vec4(0.0);\n float nDenom = 0.0;\n vec2 cell = fract(texCoord * uImageTexDim);\n for (float m = -1.0; m <= 2.0; ++m) {\n for (float n = -1.0; n <= 2.0; ++n) {\n vec4 vecData = texture2D(tex, texCoord + texelSize * vec2(m, n));\n float c = cubicFilter(m - cell.x) * cubicFilter(-n + cell.y);\n nSum += vecData * c;\n nDenom += c;\n }\n }\n return nSum / nDenom;\n }\n#endif\n\nvoid main() {\n #include clip_pixel\n\n #if defined(dInterpolation_cubic)\n vec4 imageData = biCubic(tImageTex, vUv);\n #else\n vec4 imageData = texture2D(tImageTex, vUv);\n #endif\n imageData.a = clamp(imageData.a, 0.0, 1.0);\n if (imageData.a > 0.9) imageData.a = 1.0;\n\n float fragmentDepth = gl_FragCoord.z;\n bool interior = false;\n\n #if defined(dRenderVariant_pick)\n if (imageData.a < 0.3)\n discard;\n if (uPickType == 1) {\n gl_FragColor = vec4(packIntToRGB(float(uObjectId)), 1.0);\n } else if (uPickType == 2) {\n gl_FragColor = vec4(packIntToRGB(vInstance), 1.0);\n } else {\n gl_FragColor = vec4(texture2D(tGroupTex, vUv).rgb, 1.0);\n }\n #elif defined(dRenderVariant_depth)\n if (imageData.a < 0.05)\n discard;\n gl_FragColor = packDepthToRGBA(gl_FragCoord.z);\n #elif defined(dRenderVariant_marking)\n float marker = uMarker;\n if (uMarker == -1.0) {\n float group = unpackRGBToInt(texture2D(tGroupTex, vUv).rgb);\n marker = readFromTexture(tMarker, vInstance * float(uGroupCount) + group, uMarkerTexDim).a;\n marker = floor(marker * 255.0 + 0.5); // rounding required to work on some cards on win\n }\n if (uMarkingType == 1) {\n if (marker > 0.0 || imageData.a < 0.05)\n discard;\n gl_FragColor = packDepthToRGBA(gl_FragCoord.z);\n } else {\n if (marker == 0.0 || imageData.a < 0.05)\n discard;\n float depthTest = 1.0;\n if (uMarkingDepthTest) {\n depthTest = (fragmentDepth >= getDepth(gl_FragCoord.xy / uDrawingBufferSize)) ? 1.0 : 0.0;\n }\n bool isHighlight = intMod(marker, 2.0) > 0.1;\n gl_FragColor = vec4(0.0, depthTest, isHighlight ? 1.0 : 0.0, 1.0);\n }\n #elif defined(dRenderVariant_color)\n if (imageData.a < 0.05)\n discard;\n gl_FragColor = imageData;\n gl_FragColor.a *= uAlpha;\n\n float marker = uMarker;\n if (uMarker == -1.0) {\n float group = unpackRGBToInt(texture2D(tGroupTex, vUv).rgb);\n marker = readFromTexture(tMarker, vInstance * float(uGroupCount) + group, uMarkerTexDim).a;\n marker = floor(marker * 255.0 + 0.5); // rounding required to work on some cards on win\n }\n\n #include apply_marker_color\n #include apply_fog\n #include wboit_write\n #endif\n}\n";
|
|
7
7
|
//# sourceMappingURL=image.frag.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const isosurface_frag = "\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\n#if __VERSION__ == 100\n uniform sampler2D tActiveVoxelsPyramid;\n#else\n precision highp isampler2D;\n uniform isampler2D tActiveVoxelsPyramid;\n#endif\n\nuniform sampler2D tActiveVoxelsBase;\nuniform sampler2D tVolumeData;\nuniform sampler2D tTriIndices;\n\nuniform float uIsoValue;\nuniform float uLevels;\nuniform float uSize;\nuniform float uCount;\nuniform bool uInvert;\n\nuniform vec3 uGridDim;\nuniform vec3 uGridTexDim;\nuniform mat4 uGridTransform;\n\n// scale to volume data coord\nuniform vec2 uScale;\n\n#include common\n\n// cube corners (excluding origin)\nconst vec3 c1 = vec3(1., 0., 0.);\nconst vec3 c2 = vec3(1., 1., 0.);\nconst vec3 c3 = vec3(0., 1., 0.);\nconst vec3 c4 = vec3(0., 0., 1.);\nconst vec3 c5 = vec3(1., 0., 1.);\nconst vec3 c6 = vec3(1., 1., 1.);\nconst vec3 c7 = vec3(0., 1., 1.);\n\nvec3 index3dFrom2d(vec2 coord) {\n vec2 gridTexPos = coord * uGridTexDim.xy;\n vec2 columnRow = ivec2Div(gridTexPos, uGridDim.xy);\n vec2 posXY = gridTexPos - columnRow * uGridDim.xy;\n float posZ = columnRow.y * intDiv(uGridTexDim.x, uGridDim.x) + columnRow.x;\n return vec3(posXY, posZ);\n}\n\nvec4 texture3dFrom2dNearest(sampler2D tex, vec3 pos, vec3 gridDim, vec2 texDim) {\n float zSlice = floor(pos.z * gridDim.z + 0.5); // round to nearest z-slice\n float column = intDiv(intMod(zSlice * gridDim.x, texDim.x), gridDim.x);\n float row = intDiv(zSlice * gridDim.x, texDim.x);\n vec2 coord = (vec2(column * gridDim.x, row * gridDim.y) + (pos.xy * gridDim.xy)) / (texDim / uScale);\n return texture2D(tex, coord + 0.5 / (texDim / uScale));\n}\n\nvec4 voxel(vec3 pos) {\n pos = min(max(vec3(0.0), pos), uGridDim - vec3(1.0));\n return texture3dFrom2dNearest(tVolumeData, pos / uGridDim, uGridDim, uGridTexDim.xy);\n}\n\nvec4 voxelPadded(vec3 pos) {\n pos = min(max(vec3(0.0), pos), uGridDim - vec3(vec2(2.0), 1.0)); // remove xy padding\n return texture3dFrom2dNearest(tVolumeData, pos / uGridDim, uGridDim, uGridTexDim.xy);\n}\n\nint idot2(const in ivec2 a, const in ivec2 b) {\n return a.x * b.x + a.y * b.y;\n}\n\nint idot4(const in ivec4 a, const in ivec4 b) {\n return a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w;\n}\n\n#if __VERSION__ == 100\n int pyramidVoxel(vec2 pos) {\n return int(decodeFloatRGB(texture2D(tActiveVoxelsPyramid, pos / (vec2(1.0, 0.5) * uSize)).rgb));\n }\n#else\n int pyramidVoxel(vec2 pos) {\n return texture2D(tActiveVoxelsPyramid, pos / (vec2(1.0, 0.5) * uSize)).r;\n }\n#endif\n\nvec4 baseVoxel(vec2 pos) {\n return texture2D(tActiveVoxelsBase, pos / uSize);\n}\n\nvoid main(void) {\n // get 1D index\n int vI = int(gl_FragCoord.x) + int(gl_FragCoord.y) * int(uSize);\n\n // ignore 1D indices outside of the grid\n if(vI >= int(uCount)) discard;\n\n ivec2 offset = ivec2(int(uSize) - 2, 0);\n\n int start = 0;\n ivec4 starts = ivec4(0);\n ivec4 ends = ivec4(0);\n int diff = 2;\n ivec4 m = ivec4(0);\n ivec2 position = ivec2(0);\n ivec4 vI4 = ivec4(vI);\n\n ivec2 relativePosition = ivec2(0);\n int end = 0;\n ivec2 pos1 = ivec2(0);\n ivec2 pos2 = ivec2(0);\n ivec2 pos3 = ivec2(0);\n ivec2 pos4 = ivec2(0);\n ivec3 vI3 = ivec3(vI);\n ivec3 mask = ivec3(0);\n\n // traverse the different levels of the pyramid\n for(int i = 1; i < 14; i++) {\n if(float(i) >= uLevels) break;\n\n offset.x -= diff;\n diff *= 2;\n relativePosition = position + offset;\n\n end = start + pyramidVoxel(vec2(relativePosition));\n pos1 = ivec2(relativePosition);\n starts.x = start;\n ends.x = end;\n pos2 = ivec2(relativePosition + ivec2(1, 0));\n starts.y = ends.x;\n ends.y = ends.x + pyramidVoxel(vec2(pos2));\n pos3 = relativePosition + ivec2(0, 1);\n starts.z = ends.y;\n ends.z = ends.y + pyramidVoxel(vec2(pos3));\n pos4 = relativePosition + ivec2(1, 1);\n starts.w = ends.z;\n mask = ivec3(greaterThanEqual(vI3, starts.rgb)) * ivec3(lessThan(vI3, ends.rgb));\n m = ivec4(mask, 1 - int(any(bvec3(mask))));\n\n relativePosition = m.x * pos1 + m.y * pos2 + m.z * pos3 + m.w * pos4;\n start = idot4(m, starts);\n position = 2 * (relativePosition - offset);\n }\n\n end = start + int(baseVoxel(vec2(position)).r * 255.0);\n pos1 = position;\n starts.x = start;\n ends.x = end;\n pos2 = position + ivec2(1, 0);\n starts.y = ends.x;\n ends.y = ends.x + int(baseVoxel(vec2(pos2)).r * 255.0);\n pos3 = position + ivec2(0, 1);\n starts.z = ends.y;\n ends.z = ends.y + int(baseVoxel(vec2(pos3)).r * 255.0);\n pos4 = position + ivec2(1, 1);\n starts.w = ends.z;\n mask = ivec3(greaterThanEqual(vI3, starts.rgb)) * ivec3(lessThan(vI3, ends.rgb));\n m = ivec4(mask, 1 - int(any(bvec3(mask))));\n position = m.x * pos1 + m.y * pos2 + m.z * pos3 + m.w * pos4;\n\n vec2 coord2d = (vec2(position) / uSize) / uScale;\n vec3 coord3d = floor(index3dFrom2d(coord2d) + 0.5);\n\n float edgeIndex = floor(baseVoxel(vec2(position)).a * 255.0 + 0.5);\n\n // current vertex for the up to 15 MC cases\n int currentVertex = vI - idot4(m, starts);\n\n // ensure winding-order is the same for negative and positive iso-levels\n if (uInvert) {\n int v = imod(currentVertex + 1, 3);\n if (v == 1) currentVertex += 2;\n else if (v == 0) currentVertex -= 2;\n }\n\n // get index into triIndices table\n int mcIndex = 16 * int(edgeIndex) + currentVertex;\n vec4 mcData = texture2D(tTriIndices, vec2(imod(mcIndex, 64), mcIndex / 64) / 64.);\n\n // bit mask to avoid conditionals (see comment below) for getting MC case corner\n vec4 m0 = vec4(floor(mcData.a * 255.0 + 0.5));\n\n // get edge value masks\n vec4 m1 = vec4(equal(m0, vec4(0., 1., 2., 3.)));\n vec4 m2 = vec4(equal(m0, vec4(4., 5., 6., 7.)));\n vec4 m3 = vec4(equal(m0, vec4(8., 9., 10., 11.)));\n\n // apply bit masks\n vec3 b0 = coord3d +\n m1.y * c1 +\n m1.z * c2 +\n m1.w * c3 +\n m2.x * c4 +\n m2.y * c5 +\n m2.z * c6 +\n m2.w * c7 +\n m3.y * c1 +\n m3.z * c2 +\n m3.w * c3;\n vec3 b1 = coord3d +\n m1.x * c1 +\n m1.y * c2 +\n m1.z * c3 +\n m2.x * c5 +\n m2.y * c6 +\n m2.z * c7 +\n m2.w * c4 +\n m3.x * c4 +\n m3.y * c5 +\n m3.z * c6 +\n m3.w * c7;\n\n // the conditionals that are avoided by above bitmasks\n // vec3 b0 = coord3d;\n // vec3 b1 = coord3d;\n // if (mcIndex == 0.0) {\n // b1 += c1;\n // } else if (mcIndex == 1.0) {\n // b0 += c1; b1 += c2;\n // } else if (mcIndex == 2.0) {\n // b0 += c2; b1 += c3;\n // } else if (mcIndex == 3.0) {\n // b0 += c3;\n // } else if (mcIndex == 4.0) {\n // b0 += c4; b1 += c5;\n // } else if (mcIndex == 5.0) {\n // b0 += c5; b1 += c6;\n // } else if (mcIndex == 6.0) {\n // b0 += c6; b1 += c7;\n // } else if (mcIndex == 7.0) {\n // b0 += c7; b1 += c4;\n // } else if (mcIndex == 8.0) {\n // b1 += c4;\n // } else if (mcIndex == 9.0) {\n // b0 += c1; b1 += c5;\n // } else if (mcIndex == 10.0) {\n // b0 += c2; b1 += c6;\n // } else if (mcIndex == 11.0) {\n // b0 += c3; b1 += c7;\n // }\n // b0 = floor(b0 + 0.5);\n // b1 = floor(b1 + 0.5);\n\n vec4 d0 = voxel(b0);\n vec4 d1 = voxel(b1);\n\n float v0 = d0.a;\n float v1 = d1.a;\n\n float t = (uIsoValue - v0) / (v0 - v1);\n gl_FragData[0].xyz = (uGridTransform * vec4(b0 + t * (b0 - b1), 1.0)).xyz;\n\n // group id\n #if __VERSION__ == 100\n // webgl1 does not support 'flat' interpolation (i.e. no interpolation)\n // so we ensure a constant group id per triangle here\n #ifdef dPackedGroup\n gl_FragData[1] = vec4(voxel(coord3d).rgb, 1.0);\n #else\n vec3 gridDim = uGridDim - vec3(1.0, 1.0, 0.0); // remove xy padding\n float group = coord3d.z + coord3d.y * gridDim.z + coord3d.x * gridDim.z * gridDim.y;\n gl_FragData[1] = vec4(group > 16777215.5 ? vec3(1.0) : encodeFloatRGB(group), 1.0);\n #endif\n #else\n #ifdef dPackedGroup\n gl_FragData[1] = vec4(t < 0.5 ? d0.rgb : d1.rgb, 1.0);\n #else\n vec3 b = t < 0.5 ? b0 : b1;\n vec3 gridDim = uGridDim - vec3(1.0, 1.0, 0.0); // remove xy padding\n float group = b.z + b.y * gridDim.z + b.x * gridDim.z * gridDim.y;\n gl_FragData[1] = vec4(group > 16777215.5 ? vec3(1.0) : encodeFloatRGB(group), 1.0);\n #endif\n #endif\n\n // normals from gradients\n vec3 n0 = -normalize(vec3(\n voxelPadded(b0 - c1).a - voxelPadded(b0 + c1).a,\n voxelPadded(b0 - c3).a - voxelPadded(b0 + c3).a,\n voxelPadded(b0 - c4).a - voxelPadded(b0 + c4).a\n ));\n vec3 n1 = -normalize(vec3(\n voxelPadded(b1 - c1).a - voxelPadded(b1 + c1).a,\n voxelPadded(b1 - c3).a - voxelPadded(b1 + c3).a,\n voxelPadded(b1 - c4).a - voxelPadded(b1 + c4).a\n ));\n gl_FragData[2].xyz = -vec3(\n n0.x + t * (n0.x - n1.x),\n n0.y + t * (n0.y - n1.y),\n n0.z + t * (n0.z - n1.z)\n );\n\n // ensure normal-direction is the same for negative and positive iso-levels\n if (uInvert) {\n gl_FragData[2].xyz *= -1.0;\n }\n\n // apply normal matrix\n gl_FragData[2].xyz *= transpose3(inverse3(mat3(uGridTransform)));\n}\n";
|
|
1
|
+
export declare const isosurface_frag = "\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\n#if __VERSION__ == 100\n uniform sampler2D tActiveVoxelsPyramid;\n#else\n precision highp isampler2D;\n uniform isampler2D tActiveVoxelsPyramid;\n#endif\n\nuniform sampler2D tActiveVoxelsBase;\nuniform sampler2D tVolumeData;\nuniform sampler2D tTriIndices;\n\nuniform float uIsoValue;\nuniform float uLevels;\nuniform float uSize;\nuniform float uCount;\nuniform bool uInvert;\n\nuniform vec3 uGridDim;\nuniform vec3 uGridTexDim;\nuniform mat4 uGridTransform;\n\n// scale to volume data coord\nuniform vec2 uScale;\n\n#include common\n\n// cube corners (excluding origin)\nconst vec3 c1 = vec3(1., 0., 0.);\nconst vec3 c2 = vec3(1., 1., 0.);\nconst vec3 c3 = vec3(0., 1., 0.);\nconst vec3 c4 = vec3(0., 0., 1.);\nconst vec3 c5 = vec3(1., 0., 1.);\nconst vec3 c6 = vec3(1., 1., 1.);\nconst vec3 c7 = vec3(0., 1., 1.);\n\nvec3 index3dFrom2d(vec2 coord) {\n vec2 gridTexPos = coord * uGridTexDim.xy;\n vec2 columnRow = ivec2Div(gridTexPos, uGridDim.xy);\n vec2 posXY = gridTexPos - columnRow * uGridDim.xy;\n float posZ = columnRow.y * intDiv(uGridTexDim.x, uGridDim.x) + columnRow.x;\n return vec3(posXY, posZ);\n}\n\nvec4 texture3dFrom2dNearest(sampler2D tex, vec3 pos, vec3 gridDim, vec2 texDim) {\n float zSlice = floor(pos.z * gridDim.z + 0.5); // round to nearest z-slice\n float column = intDiv(intMod(zSlice * gridDim.x, texDim.x), gridDim.x);\n float row = intDiv(zSlice * gridDim.x, texDim.x);\n vec2 coord = (vec2(column * gridDim.x, row * gridDim.y) + (pos.xy * gridDim.xy)) / (texDim / uScale);\n return texture2D(tex, coord + 0.5 / (texDim / uScale));\n}\n\nvec4 voxel(vec3 pos) {\n pos = min(max(vec3(0.0), pos), uGridDim - vec3(1.0));\n return texture3dFrom2dNearest(tVolumeData, pos / uGridDim, uGridDim, uGridTexDim.xy);\n}\n\nvec4 voxelPadded(vec3 pos) {\n pos = min(max(vec3(0.0), pos), uGridDim - vec3(vec2(2.0), 1.0)); // remove xy padding\n return texture3dFrom2dNearest(tVolumeData, pos / uGridDim, uGridDim, uGridTexDim.xy);\n}\n\nint idot2(const in ivec2 a, const in ivec2 b) {\n return a.x * b.x + a.y * b.y;\n}\n\nint idot4(const in ivec4 a, const in ivec4 b) {\n return a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w;\n}\n\n#if __VERSION__ == 100\n int pyramidVoxel(vec2 pos) {\n return int(unpackRGBToInt(texture2D(tActiveVoxelsPyramid, pos / (vec2(1.0, 0.5) * uSize)).rgb));\n }\n#else\n int pyramidVoxel(vec2 pos) {\n return texture2D(tActiveVoxelsPyramid, pos / (vec2(1.0, 0.5) * uSize)).r;\n }\n#endif\n\nvec4 baseVoxel(vec2 pos) {\n return texture2D(tActiveVoxelsBase, pos / uSize);\n}\n\nvec4 getGroup(const in vec3 p) {\n vec3 gridDim = uGridDim - vec3(1.0, 1.0, 0.0); // remove xy padding\n // note that we swap x and z because the texture is flipped around y\n #if defined(dAxisOrder_012)\n float group = p.z + p.y * gridDim.z + p.x * gridDim.z * gridDim.y; // 210\n #elif defined(dAxisOrder_021)\n float group = p.y + p.z * gridDim.y + p.x * gridDim.y * gridDim.z; // 120\n #elif defined(dAxisOrder_102)\n float group = p.z + p.x * gridDim.z + p.y * gridDim.z * gridDim.x; // 201\n #elif defined(dAxisOrder_120)\n float group = p.x + p.z * gridDim.x + p.y * gridDim.x * gridDim.z; // 021\n #elif defined(dAxisOrder_201)\n float group = p.y + p.x * gridDim.y + p.z * gridDim.y * gridDim.x; // 102\n #elif defined(dAxisOrder_210)\n float group = p.x + p.y * gridDim.x + p.z * gridDim.x * gridDim.y; // 012\n #endif\n return vec4(group > 16777215.5 ? vec3(1.0) : packIntToRGB(group), 1.0);\n}\n\nvoid main(void) {\n // get 1D index\n int vI = int(gl_FragCoord.x) + int(gl_FragCoord.y) * int(uSize);\n\n // ignore 1D indices outside of the grid\n if(vI >= int(uCount)) discard;\n\n ivec2 offset = ivec2(int(uSize) - 2, 0);\n\n int start = 0;\n ivec4 starts = ivec4(0);\n ivec4 ends = ivec4(0);\n int diff = 2;\n ivec4 m = ivec4(0);\n ivec2 position = ivec2(0);\n ivec4 vI4 = ivec4(vI);\n\n ivec2 relativePosition = ivec2(0);\n int end = 0;\n ivec2 pos1 = ivec2(0);\n ivec2 pos2 = ivec2(0);\n ivec2 pos3 = ivec2(0);\n ivec2 pos4 = ivec2(0);\n ivec3 vI3 = ivec3(vI);\n ivec3 mask = ivec3(0);\n\n // traverse the different levels of the pyramid\n for(int i = 1; i < 14; i++) {\n if(float(i) >= uLevels) break;\n\n offset.x -= diff;\n diff *= 2;\n relativePosition = position + offset;\n\n end = start + pyramidVoxel(vec2(relativePosition));\n pos1 = ivec2(relativePosition);\n starts.x = start;\n ends.x = end;\n pos2 = ivec2(relativePosition + ivec2(1, 0));\n starts.y = ends.x;\n ends.y = ends.x + pyramidVoxel(vec2(pos2));\n pos3 = relativePosition + ivec2(0, 1);\n starts.z = ends.y;\n ends.z = ends.y + pyramidVoxel(vec2(pos3));\n pos4 = relativePosition + ivec2(1, 1);\n starts.w = ends.z;\n mask = ivec3(greaterThanEqual(vI3, starts.rgb)) * ivec3(lessThan(vI3, ends.rgb));\n m = ivec4(mask, 1 - int(any(bvec3(mask))));\n\n relativePosition = m.x * pos1 + m.y * pos2 + m.z * pos3 + m.w * pos4;\n start = idot4(m, starts);\n position = 2 * (relativePosition - offset);\n }\n\n end = start + int(baseVoxel(vec2(position)).r * 255.0);\n pos1 = position;\n starts.x = start;\n ends.x = end;\n pos2 = position + ivec2(1, 0);\n starts.y = ends.x;\n ends.y = ends.x + int(baseVoxel(vec2(pos2)).r * 255.0);\n pos3 = position + ivec2(0, 1);\n starts.z = ends.y;\n ends.z = ends.y + int(baseVoxel(vec2(pos3)).r * 255.0);\n pos4 = position + ivec2(1, 1);\n starts.w = ends.z;\n mask = ivec3(greaterThanEqual(vI3, starts.rgb)) * ivec3(lessThan(vI3, ends.rgb));\n m = ivec4(mask, 1 - int(any(bvec3(mask))));\n position = m.x * pos1 + m.y * pos2 + m.z * pos3 + m.w * pos4;\n\n vec2 coord2d = (vec2(position) / uSize) / uScale;\n vec3 coord3d = floor(index3dFrom2d(coord2d) + 0.5);\n\n float edgeIndex = floor(baseVoxel(vec2(position)).a * 255.0 + 0.5);\n\n // current vertex for the up to 15 MC cases\n int currentVertex = vI - idot4(m, starts);\n\n // ensure winding-order is the same for negative and positive iso-levels\n if (uInvert) {\n int v = imod(currentVertex + 1, 3);\n if (v == 1) currentVertex += 2;\n else if (v == 0) currentVertex -= 2;\n }\n\n // get index into triIndices table\n int mcIndex = 16 * int(edgeIndex) + currentVertex;\n vec4 mcData = texture2D(tTriIndices, vec2(imod(mcIndex, 64), mcIndex / 64) / 64.);\n\n // bit mask to avoid conditionals (see comment below) for getting MC case corner\n vec4 m0 = vec4(floor(mcData.a * 255.0 + 0.5));\n\n // get edge value masks\n vec4 m1 = vec4(equal(m0, vec4(0., 1., 2., 3.)));\n vec4 m2 = vec4(equal(m0, vec4(4., 5., 6., 7.)));\n vec4 m3 = vec4(equal(m0, vec4(8., 9., 10., 11.)));\n\n // apply bit masks\n vec3 b0 = coord3d +\n m1.y * c1 +\n m1.z * c2 +\n m1.w * c3 +\n m2.x * c4 +\n m2.y * c5 +\n m2.z * c6 +\n m2.w * c7 +\n m3.y * c1 +\n m3.z * c2 +\n m3.w * c3;\n vec3 b1 = coord3d +\n m1.x * c1 +\n m1.y * c2 +\n m1.z * c3 +\n m2.x * c5 +\n m2.y * c6 +\n m2.z * c7 +\n m2.w * c4 +\n m3.x * c4 +\n m3.y * c5 +\n m3.z * c6 +\n m3.w * c7;\n\n // the conditionals that are avoided by above bitmasks\n // vec3 b0 = coord3d;\n // vec3 b1 = coord3d;\n // if (mcIndex == 0.0) {\n // b1 += c1;\n // } else if (mcIndex == 1.0) {\n // b0 += c1; b1 += c2;\n // } else if (mcIndex == 2.0) {\n // b0 += c2; b1 += c3;\n // } else if (mcIndex == 3.0) {\n // b0 += c3;\n // } else if (mcIndex == 4.0) {\n // b0 += c4; b1 += c5;\n // } else if (mcIndex == 5.0) {\n // b0 += c5; b1 += c6;\n // } else if (mcIndex == 6.0) {\n // b0 += c6; b1 += c7;\n // } else if (mcIndex == 7.0) {\n // b0 += c7; b1 += c4;\n // } else if (mcIndex == 8.0) {\n // b1 += c4;\n // } else if (mcIndex == 9.0) {\n // b0 += c1; b1 += c5;\n // } else if (mcIndex == 10.0) {\n // b0 += c2; b1 += c6;\n // } else if (mcIndex == 11.0) {\n // b0 += c3; b1 += c7;\n // }\n // b0 = floor(b0 + 0.5);\n // b1 = floor(b1 + 0.5);\n\n vec4 d0 = voxel(b0);\n vec4 d1 = voxel(b1);\n\n float v0 = d0.a;\n float v1 = d1.a;\n\n float t = (uIsoValue - v0) / (v0 - v1);\n gl_FragData[0].xyz = (uGridTransform * vec4(b0 + t * (b0 - b1), 1.0)).xyz;\n\n // group id\n #if __VERSION__ == 100\n // webgl1 does not support 'flat' interpolation (i.e. no interpolation)\n // so we ensure a constant group id per triangle here\n #ifdef dPackedGroup\n gl_FragData[1] = vec4(voxel(coord3d).rgb, 1.0);\n #else\n gl_FragData[1] = getGroup(coord3d);\n #endif\n #else\n #ifdef dPackedGroup\n gl_FragData[1] = vec4(t < 0.5 ? d0.rgb : d1.rgb, 1.0);\n #else\n gl_FragData[1] = getGroup(t < 0.5 ? b0 : b1);\n #endif\n #endif\n\n // normals from gradients\n vec3 n0 = -normalize(vec3(\n voxelPadded(b0 - c1).a - voxelPadded(b0 + c1).a,\n voxelPadded(b0 - c3).a - voxelPadded(b0 + c3).a,\n voxelPadded(b0 - c4).a - voxelPadded(b0 + c4).a\n ));\n vec3 n1 = -normalize(vec3(\n voxelPadded(b1 - c1).a - voxelPadded(b1 + c1).a,\n voxelPadded(b1 - c3).a - voxelPadded(b1 + c3).a,\n voxelPadded(b1 - c4).a - voxelPadded(b1 + c4).a\n ));\n gl_FragData[2].xyz = -vec3(\n n0.x + t * (n0.x - n1.x),\n n0.y + t * (n0.y - n1.y),\n n0.z + t * (n0.z - n1.z)\n );\n\n // ensure normal-direction is the same for negative and positive iso-levels\n if (uInvert) {\n gl_FragData[2].xyz *= -1.0;\n }\n\n // apply normal matrix\n gl_FragData[2].xyz *= transpose3(inverse3(mat3(uGridTransform)));\n}\n";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export var isosurface_frag = "\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\n#if __VERSION__ == 100\n uniform sampler2D tActiveVoxelsPyramid;\n#else\n precision highp isampler2D;\n uniform isampler2D tActiveVoxelsPyramid;\n#endif\n\nuniform sampler2D tActiveVoxelsBase;\nuniform sampler2D tVolumeData;\nuniform sampler2D tTriIndices;\n\nuniform float uIsoValue;\nuniform float uLevels;\nuniform float uSize;\nuniform float uCount;\nuniform bool uInvert;\n\nuniform vec3 uGridDim;\nuniform vec3 uGridTexDim;\nuniform mat4 uGridTransform;\n\n// scale to volume data coord\nuniform vec2 uScale;\n\n#include common\n\n// cube corners (excluding origin)\nconst vec3 c1 = vec3(1., 0., 0.);\nconst vec3 c2 = vec3(1., 1., 0.);\nconst vec3 c3 = vec3(0., 1., 0.);\nconst vec3 c4 = vec3(0., 0., 1.);\nconst vec3 c5 = vec3(1., 0., 1.);\nconst vec3 c6 = vec3(1., 1., 1.);\nconst vec3 c7 = vec3(0., 1., 1.);\n\nvec3 index3dFrom2d(vec2 coord) {\n vec2 gridTexPos = coord * uGridTexDim.xy;\n vec2 columnRow = ivec2Div(gridTexPos, uGridDim.xy);\n vec2 posXY = gridTexPos - columnRow * uGridDim.xy;\n float posZ = columnRow.y * intDiv(uGridTexDim.x, uGridDim.x) + columnRow.x;\n return vec3(posXY, posZ);\n}\n\nvec4 texture3dFrom2dNearest(sampler2D tex, vec3 pos, vec3 gridDim, vec2 texDim) {\n float zSlice = floor(pos.z * gridDim.z + 0.5); // round to nearest z-slice\n float column = intDiv(intMod(zSlice * gridDim.x, texDim.x), gridDim.x);\n float row = intDiv(zSlice * gridDim.x, texDim.x);\n vec2 coord = (vec2(column * gridDim.x, row * gridDim.y) + (pos.xy * gridDim.xy)) / (texDim / uScale);\n return texture2D(tex, coord + 0.5 / (texDim / uScale));\n}\n\nvec4 voxel(vec3 pos) {\n pos = min(max(vec3(0.0), pos), uGridDim - vec3(1.0));\n return texture3dFrom2dNearest(tVolumeData, pos / uGridDim, uGridDim, uGridTexDim.xy);\n}\n\nvec4 voxelPadded(vec3 pos) {\n pos = min(max(vec3(0.0), pos), uGridDim - vec3(vec2(2.0), 1.0)); // remove xy padding\n return texture3dFrom2dNearest(tVolumeData, pos / uGridDim, uGridDim, uGridTexDim.xy);\n}\n\nint idot2(const in ivec2 a, const in ivec2 b) {\n return a.x * b.x + a.y * b.y;\n}\n\nint idot4(const in ivec4 a, const in ivec4 b) {\n return a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w;\n}\n\n#if __VERSION__ == 100\n int pyramidVoxel(vec2 pos) {\n return int(decodeFloatRGB(texture2D(tActiveVoxelsPyramid, pos / (vec2(1.0, 0.5) * uSize)).rgb));\n }\n#else\n int pyramidVoxel(vec2 pos) {\n return texture2D(tActiveVoxelsPyramid, pos / (vec2(1.0, 0.5) * uSize)).r;\n }\n#endif\n\nvec4 baseVoxel(vec2 pos) {\n return texture2D(tActiveVoxelsBase, pos / uSize);\n}\n\nvoid main(void) {\n // get 1D index\n int vI = int(gl_FragCoord.x) + int(gl_FragCoord.y) * int(uSize);\n\n // ignore 1D indices outside of the grid\n if(vI >= int(uCount)) discard;\n\n ivec2 offset = ivec2(int(uSize) - 2, 0);\n\n int start = 0;\n ivec4 starts = ivec4(0);\n ivec4 ends = ivec4(0);\n int diff = 2;\n ivec4 m = ivec4(0);\n ivec2 position = ivec2(0);\n ivec4 vI4 = ivec4(vI);\n\n ivec2 relativePosition = ivec2(0);\n int end = 0;\n ivec2 pos1 = ivec2(0);\n ivec2 pos2 = ivec2(0);\n ivec2 pos3 = ivec2(0);\n ivec2 pos4 = ivec2(0);\n ivec3 vI3 = ivec3(vI);\n ivec3 mask = ivec3(0);\n\n // traverse the different levels of the pyramid\n for(int i = 1; i < 14; i++) {\n if(float(i) >= uLevels) break;\n\n offset.x -= diff;\n diff *= 2;\n relativePosition = position + offset;\n\n end = start + pyramidVoxel(vec2(relativePosition));\n pos1 = ivec2(relativePosition);\n starts.x = start;\n ends.x = end;\n pos2 = ivec2(relativePosition + ivec2(1, 0));\n starts.y = ends.x;\n ends.y = ends.x + pyramidVoxel(vec2(pos2));\n pos3 = relativePosition + ivec2(0, 1);\n starts.z = ends.y;\n ends.z = ends.y + pyramidVoxel(vec2(pos3));\n pos4 = relativePosition + ivec2(1, 1);\n starts.w = ends.z;\n mask = ivec3(greaterThanEqual(vI3, starts.rgb)) * ivec3(lessThan(vI3, ends.rgb));\n m = ivec4(mask, 1 - int(any(bvec3(mask))));\n\n relativePosition = m.x * pos1 + m.y * pos2 + m.z * pos3 + m.w * pos4;\n start = idot4(m, starts);\n position = 2 * (relativePosition - offset);\n }\n\n end = start + int(baseVoxel(vec2(position)).r * 255.0);\n pos1 = position;\n starts.x = start;\n ends.x = end;\n pos2 = position + ivec2(1, 0);\n starts.y = ends.x;\n ends.y = ends.x + int(baseVoxel(vec2(pos2)).r * 255.0);\n pos3 = position + ivec2(0, 1);\n starts.z = ends.y;\n ends.z = ends.y + int(baseVoxel(vec2(pos3)).r * 255.0);\n pos4 = position + ivec2(1, 1);\n starts.w = ends.z;\n mask = ivec3(greaterThanEqual(vI3, starts.rgb)) * ivec3(lessThan(vI3, ends.rgb));\n m = ivec4(mask, 1 - int(any(bvec3(mask))));\n position = m.x * pos1 + m.y * pos2 + m.z * pos3 + m.w * pos4;\n\n vec2 coord2d = (vec2(position) / uSize) / uScale;\n vec3 coord3d = floor(index3dFrom2d(coord2d) + 0.5);\n\n float edgeIndex = floor(baseVoxel(vec2(position)).a * 255.0 + 0.5);\n\n // current vertex for the up to 15 MC cases\n int currentVertex = vI - idot4(m, starts);\n\n // ensure winding-order is the same for negative and positive iso-levels\n if (uInvert) {\n int v = imod(currentVertex + 1, 3);\n if (v == 1) currentVertex += 2;\n else if (v == 0) currentVertex -= 2;\n }\n\n // get index into triIndices table\n int mcIndex = 16 * int(edgeIndex) + currentVertex;\n vec4 mcData = texture2D(tTriIndices, vec2(imod(mcIndex, 64), mcIndex / 64) / 64.);\n\n // bit mask to avoid conditionals (see comment below) for getting MC case corner\n vec4 m0 = vec4(floor(mcData.a * 255.0 + 0.5));\n\n // get edge value masks\n vec4 m1 = vec4(equal(m0, vec4(0., 1., 2., 3.)));\n vec4 m2 = vec4(equal(m0, vec4(4., 5., 6., 7.)));\n vec4 m3 = vec4(equal(m0, vec4(8., 9., 10., 11.)));\n\n // apply bit masks\n vec3 b0 = coord3d +\n m1.y * c1 +\n m1.z * c2 +\n m1.w * c3 +\n m2.x * c4 +\n m2.y * c5 +\n m2.z * c6 +\n m2.w * c7 +\n m3.y * c1 +\n m3.z * c2 +\n m3.w * c3;\n vec3 b1 = coord3d +\n m1.x * c1 +\n m1.y * c2 +\n m1.z * c3 +\n m2.x * c5 +\n m2.y * c6 +\n m2.z * c7 +\n m2.w * c4 +\n m3.x * c4 +\n m3.y * c5 +\n m3.z * c6 +\n m3.w * c7;\n\n // the conditionals that are avoided by above bitmasks\n // vec3 b0 = coord3d;\n // vec3 b1 = coord3d;\n // if (mcIndex == 0.0) {\n // b1 += c1;\n // } else if (mcIndex == 1.0) {\n // b0 += c1; b1 += c2;\n // } else if (mcIndex == 2.0) {\n // b0 += c2; b1 += c3;\n // } else if (mcIndex == 3.0) {\n // b0 += c3;\n // } else if (mcIndex == 4.0) {\n // b0 += c4; b1 += c5;\n // } else if (mcIndex == 5.0) {\n // b0 += c5; b1 += c6;\n // } else if (mcIndex == 6.0) {\n // b0 += c6; b1 += c7;\n // } else if (mcIndex == 7.0) {\n // b0 += c7; b1 += c4;\n // } else if (mcIndex == 8.0) {\n // b1 += c4;\n // } else if (mcIndex == 9.0) {\n // b0 += c1; b1 += c5;\n // } else if (mcIndex == 10.0) {\n // b0 += c2; b1 += c6;\n // } else if (mcIndex == 11.0) {\n // b0 += c3; b1 += c7;\n // }\n // b0 = floor(b0 + 0.5);\n // b1 = floor(b1 + 0.5);\n\n vec4 d0 = voxel(b0);\n vec4 d1 = voxel(b1);\n\n float v0 = d0.a;\n float v1 = d1.a;\n\n float t = (uIsoValue - v0) / (v0 - v1);\n gl_FragData[0].xyz = (uGridTransform * vec4(b0 + t * (b0 - b1), 1.0)).xyz;\n\n // group id\n #if __VERSION__ == 100\n // webgl1 does not support 'flat' interpolation (i.e. no interpolation)\n // so we ensure a constant group id per triangle here\n #ifdef dPackedGroup\n gl_FragData[1] = vec4(voxel(coord3d).rgb, 1.0);\n #else\n vec3 gridDim = uGridDim - vec3(1.0, 1.0, 0.0); // remove xy padding\n float group = coord3d.z + coord3d.y * gridDim.z + coord3d.x * gridDim.z * gridDim.y;\n gl_FragData[1] = vec4(group > 16777215.5 ? vec3(1.0) : encodeFloatRGB(group), 1.0);\n #endif\n #else\n #ifdef dPackedGroup\n gl_FragData[1] = vec4(t < 0.5 ? d0.rgb : d1.rgb, 1.0);\n #else\n vec3 b = t < 0.5 ? b0 : b1;\n vec3 gridDim = uGridDim - vec3(1.0, 1.0, 0.0); // remove xy padding\n float group = b.z + b.y * gridDim.z + b.x * gridDim.z * gridDim.y;\n gl_FragData[1] = vec4(group > 16777215.5 ? vec3(1.0) : encodeFloatRGB(group), 1.0);\n #endif\n #endif\n\n // normals from gradients\n vec3 n0 = -normalize(vec3(\n voxelPadded(b0 - c1).a - voxelPadded(b0 + c1).a,\n voxelPadded(b0 - c3).a - voxelPadded(b0 + c3).a,\n voxelPadded(b0 - c4).a - voxelPadded(b0 + c4).a\n ));\n vec3 n1 = -normalize(vec3(\n voxelPadded(b1 - c1).a - voxelPadded(b1 + c1).a,\n voxelPadded(b1 - c3).a - voxelPadded(b1 + c3).a,\n voxelPadded(b1 - c4).a - voxelPadded(b1 + c4).a\n ));\n gl_FragData[2].xyz = -vec3(\n n0.x + t * (n0.x - n1.x),\n n0.y + t * (n0.y - n1.y),\n n0.z + t * (n0.z - n1.z)\n );\n\n // ensure normal-direction is the same for negative and positive iso-levels\n if (uInvert) {\n gl_FragData[2].xyz *= -1.0;\n }\n\n // apply normal matrix\n gl_FragData[2].xyz *= transpose3(inverse3(mat3(uGridTransform)));\n}\n";
|
|
1
|
+
export var isosurface_frag = "\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\n#if __VERSION__ == 100\n uniform sampler2D tActiveVoxelsPyramid;\n#else\n precision highp isampler2D;\n uniform isampler2D tActiveVoxelsPyramid;\n#endif\n\nuniform sampler2D tActiveVoxelsBase;\nuniform sampler2D tVolumeData;\nuniform sampler2D tTriIndices;\n\nuniform float uIsoValue;\nuniform float uLevels;\nuniform float uSize;\nuniform float uCount;\nuniform bool uInvert;\n\nuniform vec3 uGridDim;\nuniform vec3 uGridTexDim;\nuniform mat4 uGridTransform;\n\n// scale to volume data coord\nuniform vec2 uScale;\n\n#include common\n\n// cube corners (excluding origin)\nconst vec3 c1 = vec3(1., 0., 0.);\nconst vec3 c2 = vec3(1., 1., 0.);\nconst vec3 c3 = vec3(0., 1., 0.);\nconst vec3 c4 = vec3(0., 0., 1.);\nconst vec3 c5 = vec3(1., 0., 1.);\nconst vec3 c6 = vec3(1., 1., 1.);\nconst vec3 c7 = vec3(0., 1., 1.);\n\nvec3 index3dFrom2d(vec2 coord) {\n vec2 gridTexPos = coord * uGridTexDim.xy;\n vec2 columnRow = ivec2Div(gridTexPos, uGridDim.xy);\n vec2 posXY = gridTexPos - columnRow * uGridDim.xy;\n float posZ = columnRow.y * intDiv(uGridTexDim.x, uGridDim.x) + columnRow.x;\n return vec3(posXY, posZ);\n}\n\nvec4 texture3dFrom2dNearest(sampler2D tex, vec3 pos, vec3 gridDim, vec2 texDim) {\n float zSlice = floor(pos.z * gridDim.z + 0.5); // round to nearest z-slice\n float column = intDiv(intMod(zSlice * gridDim.x, texDim.x), gridDim.x);\n float row = intDiv(zSlice * gridDim.x, texDim.x);\n vec2 coord = (vec2(column * gridDim.x, row * gridDim.y) + (pos.xy * gridDim.xy)) / (texDim / uScale);\n return texture2D(tex, coord + 0.5 / (texDim / uScale));\n}\n\nvec4 voxel(vec3 pos) {\n pos = min(max(vec3(0.0), pos), uGridDim - vec3(1.0));\n return texture3dFrom2dNearest(tVolumeData, pos / uGridDim, uGridDim, uGridTexDim.xy);\n}\n\nvec4 voxelPadded(vec3 pos) {\n pos = min(max(vec3(0.0), pos), uGridDim - vec3(vec2(2.0), 1.0)); // remove xy padding\n return texture3dFrom2dNearest(tVolumeData, pos / uGridDim, uGridDim, uGridTexDim.xy);\n}\n\nint idot2(const in ivec2 a, const in ivec2 b) {\n return a.x * b.x + a.y * b.y;\n}\n\nint idot4(const in ivec4 a, const in ivec4 b) {\n return a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w;\n}\n\n#if __VERSION__ == 100\n int pyramidVoxel(vec2 pos) {\n return int(unpackRGBToInt(texture2D(tActiveVoxelsPyramid, pos / (vec2(1.0, 0.5) * uSize)).rgb));\n }\n#else\n int pyramidVoxel(vec2 pos) {\n return texture2D(tActiveVoxelsPyramid, pos / (vec2(1.0, 0.5) * uSize)).r;\n }\n#endif\n\nvec4 baseVoxel(vec2 pos) {\n return texture2D(tActiveVoxelsBase, pos / uSize);\n}\n\nvec4 getGroup(const in vec3 p) {\n vec3 gridDim = uGridDim - vec3(1.0, 1.0, 0.0); // remove xy padding\n // note that we swap x and z because the texture is flipped around y\n #if defined(dAxisOrder_012)\n float group = p.z + p.y * gridDim.z + p.x * gridDim.z * gridDim.y; // 210\n #elif defined(dAxisOrder_021)\n float group = p.y + p.z * gridDim.y + p.x * gridDim.y * gridDim.z; // 120\n #elif defined(dAxisOrder_102)\n float group = p.z + p.x * gridDim.z + p.y * gridDim.z * gridDim.x; // 201\n #elif defined(dAxisOrder_120)\n float group = p.x + p.z * gridDim.x + p.y * gridDim.x * gridDim.z; // 021\n #elif defined(dAxisOrder_201)\n float group = p.y + p.x * gridDim.y + p.z * gridDim.y * gridDim.x; // 102\n #elif defined(dAxisOrder_210)\n float group = p.x + p.y * gridDim.x + p.z * gridDim.x * gridDim.y; // 012\n #endif\n return vec4(group > 16777215.5 ? vec3(1.0) : packIntToRGB(group), 1.0);\n}\n\nvoid main(void) {\n // get 1D index\n int vI = int(gl_FragCoord.x) + int(gl_FragCoord.y) * int(uSize);\n\n // ignore 1D indices outside of the grid\n if(vI >= int(uCount)) discard;\n\n ivec2 offset = ivec2(int(uSize) - 2, 0);\n\n int start = 0;\n ivec4 starts = ivec4(0);\n ivec4 ends = ivec4(0);\n int diff = 2;\n ivec4 m = ivec4(0);\n ivec2 position = ivec2(0);\n ivec4 vI4 = ivec4(vI);\n\n ivec2 relativePosition = ivec2(0);\n int end = 0;\n ivec2 pos1 = ivec2(0);\n ivec2 pos2 = ivec2(0);\n ivec2 pos3 = ivec2(0);\n ivec2 pos4 = ivec2(0);\n ivec3 vI3 = ivec3(vI);\n ivec3 mask = ivec3(0);\n\n // traverse the different levels of the pyramid\n for(int i = 1; i < 14; i++) {\n if(float(i) >= uLevels) break;\n\n offset.x -= diff;\n diff *= 2;\n relativePosition = position + offset;\n\n end = start + pyramidVoxel(vec2(relativePosition));\n pos1 = ivec2(relativePosition);\n starts.x = start;\n ends.x = end;\n pos2 = ivec2(relativePosition + ivec2(1, 0));\n starts.y = ends.x;\n ends.y = ends.x + pyramidVoxel(vec2(pos2));\n pos3 = relativePosition + ivec2(0, 1);\n starts.z = ends.y;\n ends.z = ends.y + pyramidVoxel(vec2(pos3));\n pos4 = relativePosition + ivec2(1, 1);\n starts.w = ends.z;\n mask = ivec3(greaterThanEqual(vI3, starts.rgb)) * ivec3(lessThan(vI3, ends.rgb));\n m = ivec4(mask, 1 - int(any(bvec3(mask))));\n\n relativePosition = m.x * pos1 + m.y * pos2 + m.z * pos3 + m.w * pos4;\n start = idot4(m, starts);\n position = 2 * (relativePosition - offset);\n }\n\n end = start + int(baseVoxel(vec2(position)).r * 255.0);\n pos1 = position;\n starts.x = start;\n ends.x = end;\n pos2 = position + ivec2(1, 0);\n starts.y = ends.x;\n ends.y = ends.x + int(baseVoxel(vec2(pos2)).r * 255.0);\n pos3 = position + ivec2(0, 1);\n starts.z = ends.y;\n ends.z = ends.y + int(baseVoxel(vec2(pos3)).r * 255.0);\n pos4 = position + ivec2(1, 1);\n starts.w = ends.z;\n mask = ivec3(greaterThanEqual(vI3, starts.rgb)) * ivec3(lessThan(vI3, ends.rgb));\n m = ivec4(mask, 1 - int(any(bvec3(mask))));\n position = m.x * pos1 + m.y * pos2 + m.z * pos3 + m.w * pos4;\n\n vec2 coord2d = (vec2(position) / uSize) / uScale;\n vec3 coord3d = floor(index3dFrom2d(coord2d) + 0.5);\n\n float edgeIndex = floor(baseVoxel(vec2(position)).a * 255.0 + 0.5);\n\n // current vertex for the up to 15 MC cases\n int currentVertex = vI - idot4(m, starts);\n\n // ensure winding-order is the same for negative and positive iso-levels\n if (uInvert) {\n int v = imod(currentVertex + 1, 3);\n if (v == 1) currentVertex += 2;\n else if (v == 0) currentVertex -= 2;\n }\n\n // get index into triIndices table\n int mcIndex = 16 * int(edgeIndex) + currentVertex;\n vec4 mcData = texture2D(tTriIndices, vec2(imod(mcIndex, 64), mcIndex / 64) / 64.);\n\n // bit mask to avoid conditionals (see comment below) for getting MC case corner\n vec4 m0 = vec4(floor(mcData.a * 255.0 + 0.5));\n\n // get edge value masks\n vec4 m1 = vec4(equal(m0, vec4(0., 1., 2., 3.)));\n vec4 m2 = vec4(equal(m0, vec4(4., 5., 6., 7.)));\n vec4 m3 = vec4(equal(m0, vec4(8., 9., 10., 11.)));\n\n // apply bit masks\n vec3 b0 = coord3d +\n m1.y * c1 +\n m1.z * c2 +\n m1.w * c3 +\n m2.x * c4 +\n m2.y * c5 +\n m2.z * c6 +\n m2.w * c7 +\n m3.y * c1 +\n m3.z * c2 +\n m3.w * c3;\n vec3 b1 = coord3d +\n m1.x * c1 +\n m1.y * c2 +\n m1.z * c3 +\n m2.x * c5 +\n m2.y * c6 +\n m2.z * c7 +\n m2.w * c4 +\n m3.x * c4 +\n m3.y * c5 +\n m3.z * c6 +\n m3.w * c7;\n\n // the conditionals that are avoided by above bitmasks\n // vec3 b0 = coord3d;\n // vec3 b1 = coord3d;\n // if (mcIndex == 0.0) {\n // b1 += c1;\n // } else if (mcIndex == 1.0) {\n // b0 += c1; b1 += c2;\n // } else if (mcIndex == 2.0) {\n // b0 += c2; b1 += c3;\n // } else if (mcIndex == 3.0) {\n // b0 += c3;\n // } else if (mcIndex == 4.0) {\n // b0 += c4; b1 += c5;\n // } else if (mcIndex == 5.0) {\n // b0 += c5; b1 += c6;\n // } else if (mcIndex == 6.0) {\n // b0 += c6; b1 += c7;\n // } else if (mcIndex == 7.0) {\n // b0 += c7; b1 += c4;\n // } else if (mcIndex == 8.0) {\n // b1 += c4;\n // } else if (mcIndex == 9.0) {\n // b0 += c1; b1 += c5;\n // } else if (mcIndex == 10.0) {\n // b0 += c2; b1 += c6;\n // } else if (mcIndex == 11.0) {\n // b0 += c3; b1 += c7;\n // }\n // b0 = floor(b0 + 0.5);\n // b1 = floor(b1 + 0.5);\n\n vec4 d0 = voxel(b0);\n vec4 d1 = voxel(b1);\n\n float v0 = d0.a;\n float v1 = d1.a;\n\n float t = (uIsoValue - v0) / (v0 - v1);\n gl_FragData[0].xyz = (uGridTransform * vec4(b0 + t * (b0 - b1), 1.0)).xyz;\n\n // group id\n #if __VERSION__ == 100\n // webgl1 does not support 'flat' interpolation (i.e. no interpolation)\n // so we ensure a constant group id per triangle here\n #ifdef dPackedGroup\n gl_FragData[1] = vec4(voxel(coord3d).rgb, 1.0);\n #else\n gl_FragData[1] = getGroup(coord3d);\n #endif\n #else\n #ifdef dPackedGroup\n gl_FragData[1] = vec4(t < 0.5 ? d0.rgb : d1.rgb, 1.0);\n #else\n gl_FragData[1] = getGroup(t < 0.5 ? b0 : b1);\n #endif\n #endif\n\n // normals from gradients\n vec3 n0 = -normalize(vec3(\n voxelPadded(b0 - c1).a - voxelPadded(b0 + c1).a,\n voxelPadded(b0 - c3).a - voxelPadded(b0 + c3).a,\n voxelPadded(b0 - c4).a - voxelPadded(b0 + c4).a\n ));\n vec3 n1 = -normalize(vec3(\n voxelPadded(b1 - c1).a - voxelPadded(b1 + c1).a,\n voxelPadded(b1 - c3).a - voxelPadded(b1 + c3).a,\n voxelPadded(b1 - c4).a - voxelPadded(b1 + c4).a\n ));\n gl_FragData[2].xyz = -vec3(\n n0.x + t * (n0.x - n1.x),\n n0.y + t * (n0.y - n1.y),\n n0.z + t * (n0.z - n1.z)\n );\n\n // ensure normal-direction is the same for negative and positive iso-levels\n if (uInvert) {\n gl_FragData[2].xyz *= -1.0;\n }\n\n // apply normal matrix\n gl_FragData[2].xyz *= transpose3(inverse3(mat3(uGridTransform)));\n}\n";
|
|
2
2
|
//# sourceMappingURL=isosurface.frag.js.map
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
|
5
5
|
*/
|
|
6
|
-
export declare const mesh_frag = "\nprecision highp float;\nprecision highp int;\n\n#define bumpEnabled\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include light_frag_params\n#include normal_frag_params\n#include common_clip\n\nvoid main() {\n #include clip_pixel\n\n // Workaround for buggy gl_FrontFacing (e.g. on some integrated Intel GPUs)\n vec3 fdx = dFdx(vViewPosition);\n vec3 fdy = dFdy(vViewPosition);\n vec3 faceNormal = normalize(cross(fdx,fdy));\n bool frontFacing = dot(vNormal, faceNormal) > 0.0;\n\n #if defined(dFlipSided)\n interior = frontFacing;\n #else\n interior = !frontFacing;\n #endif\n\n float fragmentDepth = gl_FragCoord.z;\n #include assign_material_color\n\n #if defined(dRenderVariant_pick)\n #include check_picking_alpha\n gl_FragColor = material;\n #elif defined(dRenderVariant_depth)\n gl_FragColor = material;\n #elif defined(dRenderVariant_marking)\n gl_FragColor = material;\n #elif defined(dRenderVariant_color)\n #ifdef dIgnoreLight\n gl_FragColor = material;\n #else\n #if defined(dFlatShaded)\n vec3 normal = -faceNormal;\n #else\n vec3 normal = -normalize(vNormal);\n
|
|
6
|
+
export declare const mesh_frag = "\nprecision highp float;\nprecision highp int;\n\n#define bumpEnabled\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include light_frag_params\n#include normal_frag_params\n#include common_clip\n\nvoid main() {\n #include clip_pixel\n\n // Workaround for buggy gl_FrontFacing (e.g. on some integrated Intel GPUs)\n vec3 fdx = dFdx(vViewPosition);\n vec3 fdy = dFdy(vViewPosition);\n vec3 faceNormal = normalize(cross(fdx,fdy));\n bool frontFacing = dot(vNormal, faceNormal) > 0.0;\n\n #if defined(dFlipSided)\n interior = frontFacing;\n #else\n interior = !frontFacing;\n #endif\n\n float fragmentDepth = gl_FragCoord.z;\n #include assign_material_color\n\n #if defined(dRenderVariant_pick)\n #include check_picking_alpha\n gl_FragColor = material;\n #elif defined(dRenderVariant_depth)\n gl_FragColor = material;\n #elif defined(dRenderVariant_marking)\n gl_FragColor = material;\n #elif defined(dRenderVariant_color)\n #ifdef dIgnoreLight\n gl_FragColor = material;\n #else\n #if defined(dFlatShaded)\n vec3 normal = -faceNormal;\n #else\n vec3 normal = -normalize(vNormal);\n if (uDoubleSided) normal *= float(frontFacing) * 2.0 - 1.0;\n #endif\n #include apply_light_color\n #endif\n\n #include apply_interior_color\n #include apply_marker_color\n #include apply_fog\n #include wboit_write\n #endif\n}\n";
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
|
5
5
|
*/
|
|
6
|
-
export var mesh_frag = "\nprecision highp float;\nprecision highp int;\n\n#define bumpEnabled\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include light_frag_params\n#include normal_frag_params\n#include common_clip\n\nvoid main() {\n #include clip_pixel\n\n // Workaround for buggy gl_FrontFacing (e.g. on some integrated Intel GPUs)\n vec3 fdx = dFdx(vViewPosition);\n vec3 fdy = dFdy(vViewPosition);\n vec3 faceNormal = normalize(cross(fdx,fdy));\n bool frontFacing = dot(vNormal, faceNormal) > 0.0;\n\n #if defined(dFlipSided)\n interior = frontFacing;\n #else\n interior = !frontFacing;\n #endif\n\n float fragmentDepth = gl_FragCoord.z;\n #include assign_material_color\n\n #if defined(dRenderVariant_pick)\n #include check_picking_alpha\n gl_FragColor = material;\n #elif defined(dRenderVariant_depth)\n gl_FragColor = material;\n #elif defined(dRenderVariant_marking)\n gl_FragColor = material;\n #elif defined(dRenderVariant_color)\n #ifdef dIgnoreLight\n gl_FragColor = material;\n #else\n #if defined(dFlatShaded)\n vec3 normal = -faceNormal;\n #else\n vec3 normal = -normalize(vNormal);\n
|
|
6
|
+
export var mesh_frag = "\nprecision highp float;\nprecision highp int;\n\n#define bumpEnabled\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include light_frag_params\n#include normal_frag_params\n#include common_clip\n\nvoid main() {\n #include clip_pixel\n\n // Workaround for buggy gl_FrontFacing (e.g. on some integrated Intel GPUs)\n vec3 fdx = dFdx(vViewPosition);\n vec3 fdy = dFdy(vViewPosition);\n vec3 faceNormal = normalize(cross(fdx,fdy));\n bool frontFacing = dot(vNormal, faceNormal) > 0.0;\n\n #if defined(dFlipSided)\n interior = frontFacing;\n #else\n interior = !frontFacing;\n #endif\n\n float fragmentDepth = gl_FragCoord.z;\n #include assign_material_color\n\n #if defined(dRenderVariant_pick)\n #include check_picking_alpha\n gl_FragColor = material;\n #elif defined(dRenderVariant_depth)\n gl_FragColor = material;\n #elif defined(dRenderVariant_marking)\n gl_FragColor = material;\n #elif defined(dRenderVariant_color)\n #ifdef dIgnoreLight\n gl_FragColor = material;\n #else\n #if defined(dFlatShaded)\n vec3 normal = -faceNormal;\n #else\n vec3 normal = -normalize(vNormal);\n if (uDoubleSided) normal *= float(frontFacing) * 2.0 - 1.0;\n #endif\n #include apply_light_color\n #endif\n\n #include apply_interior_color\n #include apply_marker_color\n #include apply_fog\n #include wboit_write\n #endif\n}\n";
|
|
7
7
|
//# sourceMappingURL=mesh.frag.js.map
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
|
5
5
|
*/
|
|
6
|
-
export declare const mesh_vert = "\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\n#include common\n#include read_from_texture\n#include common_vert_params\n#include color_vert_params\n#include common_clip\n#include texture3d_from_2d_linear\n\n#ifdef
|
|
6
|
+
export declare const mesh_vert = "\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\n#include common\n#include read_from_texture\n#include common_vert_params\n#include color_vert_params\n#include common_clip\n#include texture3d_from_2d_linear\n\n#ifdef dGeometryType_textureMesh\n uniform vec2 uGeoTexDim;\n uniform sampler2D tPosition;\n uniform sampler2D tGroup;\n uniform sampler2D tNormal;\n#else\n attribute vec3 aPosition;\n attribute float aGroup;\n attribute vec3 aNormal;\n#endif\nattribute mat4 aTransform;\nattribute float aInstance;\n\nvarying vec3 vNormal;\n\nvoid main(){\n #include assign_group\n #include assign_marker_varying\n #include assign_clipping_varying\n #include assign_position\n #include assign_color_varying\n #include clip_instance\n\n #ifdef dGeometryType_textureMesh\n vec3 normal = readFromTexture(tNormal, VertexID, uGeoTexDim).xyz;\n #else\n vec3 normal = aNormal;\n #endif\n mat3 normalMatrix = transpose3(inverse3(mat3(modelView)));\n vec3 transformedNormal = normalize(normalMatrix * normalize(normal));\n #if defined(dFlipSided)\n if (!uDoubleSided) { // TODO checking uDoubleSided should not be required, ASR\n transformedNormal = -transformedNormal;\n }\n #endif\n vNormal = transformedNormal;\n}\n";
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
|
5
5
|
*/
|
|
6
|
-
export var mesh_vert = "\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\n#include common\n#include read_from_texture\n#include common_vert_params\n#include color_vert_params\n#include common_clip\n#include texture3d_from_2d_linear\n\n#ifdef
|
|
6
|
+
export var mesh_vert = "\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\n#include common\n#include read_from_texture\n#include common_vert_params\n#include color_vert_params\n#include common_clip\n#include texture3d_from_2d_linear\n\n#ifdef dGeometryType_textureMesh\n uniform vec2 uGeoTexDim;\n uniform sampler2D tPosition;\n uniform sampler2D tGroup;\n uniform sampler2D tNormal;\n#else\n attribute vec3 aPosition;\n attribute float aGroup;\n attribute vec3 aNormal;\n#endif\nattribute mat4 aTransform;\nattribute float aInstance;\n\nvarying vec3 vNormal;\n\nvoid main(){\n #include assign_group\n #include assign_marker_varying\n #include assign_clipping_varying\n #include assign_position\n #include assign_color_varying\n #include clip_instance\n\n #ifdef dGeometryType_textureMesh\n vec3 normal = readFromTexture(tNormal, VertexID, uGeoTexDim).xyz;\n #else\n vec3 normal = aNormal;\n #endif\n mat3 normalMatrix = transpose3(inverse3(mat3(modelView)));\n vec3 transformedNormal = normalize(normalMatrix * normalize(normal));\n #if defined(dFlipSided)\n if (!uDoubleSided) { // TODO checking uDoubleSided should not be required, ASR\n transformedNormal = -transformedNormal;\n }\n #endif\n vNormal = transformedNormal;\n}\n";
|
|
7
7
|
//# sourceMappingURL=mesh.vert.js.map
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
|
5
5
|
*/
|
|
6
|
-
export declare const spheres_frag = "\nprecision highp float;\nprecision highp int;\n\n#define bumpEnabled\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include light_frag_params\n#include common_clip\n\nuniform mat4 uInvView;\n\nvarying float vRadius;\nvarying float vRadiusSq;\nvarying vec3 vPoint;\nvarying vec3 vPointViewPosition;\n\nvec3 cameraPos;\nvec3 cameraNormal;\n\nbool Impostor(out vec3 cameraPos, out vec3 cameraNormal){\n vec3 cameraSpherePos = -vPointViewPosition;\n cameraSpherePos.z += vRadius;\n\n vec3 rayOrigin = mix(vec3(0.0, 0.0, 0.0), vPoint, uIsOrtho);\n vec3 rayDirection = mix(normalize(vPoint), vec3(0.0, 0.0, 1.0), uIsOrtho);\n vec3 cameraSphereDir = mix(cameraSpherePos, rayOrigin - cameraSpherePos, uIsOrtho);\n\n float B = dot(rayDirection, cameraSphereDir);\n float det = B * B + vRadiusSq - dot(cameraSphereDir, cameraSphereDir);\n\n if (det < 0.0){\n discard;\n return false;\n }\n\n float sqrtDet = sqrt(det);\n float posT = mix(B + sqrtDet, B + sqrtDet, uIsOrtho);\n float negT = mix(B - sqrtDet, sqrtDet - B, uIsOrtho);\n\n cameraPos = rayDirection * negT + rayOrigin;\n\n\n if (calcDepth(cameraPos) <= 0.0) {\n cameraPos = rayDirection * posT + rayOrigin;\n interior = true;\n } else {\n interior = false;\n }\n\n cameraNormal = normalize(cameraPos - cameraSpherePos);\n cameraNormal *= float(!interior) * 2.0 - 1.0;\n\n return !interior;\n}\n\nvoid main(void){\n #include clip_pixel\n\n bool flag = Impostor(cameraPos, cameraNormal);\n
|
|
6
|
+
export declare const spheres_frag = "\nprecision highp float;\nprecision highp int;\n\n#define bumpEnabled\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include light_frag_params\n#include common_clip\n\nuniform mat4 uInvView;\n\nvarying float vRadius;\nvarying float vRadiusSq;\nvarying vec3 vPoint;\nvarying vec3 vPointViewPosition;\n\nvec3 cameraPos;\nvec3 cameraNormal;\n\nbool Impostor(out vec3 cameraPos, out vec3 cameraNormal){\n vec3 cameraSpherePos = -vPointViewPosition;\n cameraSpherePos.z += vRadius;\n\n vec3 rayOrigin = mix(vec3(0.0, 0.0, 0.0), vPoint, uIsOrtho);\n vec3 rayDirection = mix(normalize(vPoint), vec3(0.0, 0.0, 1.0), uIsOrtho);\n vec3 cameraSphereDir = mix(cameraSpherePos, rayOrigin - cameraSpherePos, uIsOrtho);\n\n float B = dot(rayDirection, cameraSphereDir);\n float det = B * B + vRadiusSq - dot(cameraSphereDir, cameraSphereDir);\n\n if (det < 0.0){\n discard;\n return false;\n }\n\n float sqrtDet = sqrt(det);\n float posT = mix(B + sqrtDet, B + sqrtDet, uIsOrtho);\n float negT = mix(B - sqrtDet, sqrtDet - B, uIsOrtho);\n\n cameraPos = rayDirection * negT + rayOrigin;\n\n\n if (calcDepth(cameraPos) <= 0.0) {\n cameraPos = rayDirection * posT + rayOrigin;\n interior = true;\n } else {\n interior = false;\n }\n\n cameraNormal = normalize(cameraPos - cameraSpherePos);\n cameraNormal *= float(!interior) * 2.0 - 1.0;\n\n return !interior;\n}\n\nvoid main(void){\n #include clip_pixel\n\n bool flag = Impostor(cameraPos, cameraNormal);\n if (!uDoubleSided) {\n if (interior) discard;\n }\n\n vec3 vViewPosition = cameraPos;\n gl_FragDepthEXT = calcDepth(vViewPosition);\n if (!flag && gl_FragDepthEXT >= 0.0) {\n gl_FragDepthEXT = 0.0 + (0.0000001 / vRadius);\n }\n\n vec3 vModelPosition = (uInvView * vec4(vViewPosition, 1.0)).xyz;\n\n if (gl_FragDepthEXT < 0.0) discard;\n if (gl_FragDepthEXT > 1.0) discard;\n\n float fragmentDepth = gl_FragDepthEXT;\n #include assign_material_color\n\n #if defined(dRenderVariant_pick)\n #include check_picking_alpha\n gl_FragColor = material;\n #elif defined(dRenderVariant_depth)\n gl_FragColor = material;\n #elif defined(dRenderVariant_marking)\n gl_FragColor = material;\n #elif defined(dRenderVariant_color)\n #ifdef dIgnoreLight\n gl_FragColor = material;\n #else\n vec3 normal = -cameraNormal;\n #include apply_light_color\n #endif\n\n #include apply_interior_color\n #include apply_marker_color\n #include apply_fog\n #include wboit_write\n #endif\n}\n";
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
|
5
5
|
*/
|
|
6
|
-
export var spheres_frag = "\nprecision highp float;\nprecision highp int;\n\n#define bumpEnabled\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include light_frag_params\n#include common_clip\n\nuniform mat4 uInvView;\n\nvarying float vRadius;\nvarying float vRadiusSq;\nvarying vec3 vPoint;\nvarying vec3 vPointViewPosition;\n\nvec3 cameraPos;\nvec3 cameraNormal;\n\nbool Impostor(out vec3 cameraPos, out vec3 cameraNormal){\n vec3 cameraSpherePos = -vPointViewPosition;\n cameraSpherePos.z += vRadius;\n\n vec3 rayOrigin = mix(vec3(0.0, 0.0, 0.0), vPoint, uIsOrtho);\n vec3 rayDirection = mix(normalize(vPoint), vec3(0.0, 0.0, 1.0), uIsOrtho);\n vec3 cameraSphereDir = mix(cameraSpherePos, rayOrigin - cameraSpherePos, uIsOrtho);\n\n float B = dot(rayDirection, cameraSphereDir);\n float det = B * B + vRadiusSq - dot(cameraSphereDir, cameraSphereDir);\n\n if (det < 0.0){\n discard;\n return false;\n }\n\n float sqrtDet = sqrt(det);\n float posT = mix(B + sqrtDet, B + sqrtDet, uIsOrtho);\n float negT = mix(B - sqrtDet, sqrtDet - B, uIsOrtho);\n\n cameraPos = rayDirection * negT + rayOrigin;\n\n\n if (calcDepth(cameraPos) <= 0.0) {\n cameraPos = rayDirection * posT + rayOrigin;\n interior = true;\n } else {\n interior = false;\n }\n\n cameraNormal = normalize(cameraPos - cameraSpherePos);\n cameraNormal *= float(!interior) * 2.0 - 1.0;\n\n return !interior;\n}\n\nvoid main(void){\n #include clip_pixel\n\n bool flag = Impostor(cameraPos, cameraNormal);\n
|
|
6
|
+
export var spheres_frag = "\nprecision highp float;\nprecision highp int;\n\n#define bumpEnabled\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include light_frag_params\n#include common_clip\n\nuniform mat4 uInvView;\n\nvarying float vRadius;\nvarying float vRadiusSq;\nvarying vec3 vPoint;\nvarying vec3 vPointViewPosition;\n\nvec3 cameraPos;\nvec3 cameraNormal;\n\nbool Impostor(out vec3 cameraPos, out vec3 cameraNormal){\n vec3 cameraSpherePos = -vPointViewPosition;\n cameraSpherePos.z += vRadius;\n\n vec3 rayOrigin = mix(vec3(0.0, 0.0, 0.0), vPoint, uIsOrtho);\n vec3 rayDirection = mix(normalize(vPoint), vec3(0.0, 0.0, 1.0), uIsOrtho);\n vec3 cameraSphereDir = mix(cameraSpherePos, rayOrigin - cameraSpherePos, uIsOrtho);\n\n float B = dot(rayDirection, cameraSphereDir);\n float det = B * B + vRadiusSq - dot(cameraSphereDir, cameraSphereDir);\n\n if (det < 0.0){\n discard;\n return false;\n }\n\n float sqrtDet = sqrt(det);\n float posT = mix(B + sqrtDet, B + sqrtDet, uIsOrtho);\n float negT = mix(B - sqrtDet, sqrtDet - B, uIsOrtho);\n\n cameraPos = rayDirection * negT + rayOrigin;\n\n\n if (calcDepth(cameraPos) <= 0.0) {\n cameraPos = rayDirection * posT + rayOrigin;\n interior = true;\n } else {\n interior = false;\n }\n\n cameraNormal = normalize(cameraPos - cameraSpherePos);\n cameraNormal *= float(!interior) * 2.0 - 1.0;\n\n return !interior;\n}\n\nvoid main(void){\n #include clip_pixel\n\n bool flag = Impostor(cameraPos, cameraNormal);\n if (!uDoubleSided) {\n if (interior) discard;\n }\n\n vec3 vViewPosition = cameraPos;\n gl_FragDepthEXT = calcDepth(vViewPosition);\n if (!flag && gl_FragDepthEXT >= 0.0) {\n gl_FragDepthEXT = 0.0 + (0.0000001 / vRadius);\n }\n\n vec3 vModelPosition = (uInvView * vec4(vViewPosition, 1.0)).xyz;\n\n if (gl_FragDepthEXT < 0.0) discard;\n if (gl_FragDepthEXT > 1.0) discard;\n\n float fragmentDepth = gl_FragDepthEXT;\n #include assign_material_color\n\n #if defined(dRenderVariant_pick)\n #include check_picking_alpha\n gl_FragColor = material;\n #elif defined(dRenderVariant_depth)\n gl_FragColor = material;\n #elif defined(dRenderVariant_marking)\n gl_FragColor = material;\n #elif defined(dRenderVariant_color)\n #ifdef dIgnoreLight\n gl_FragColor = material;\n #else\n vec3 normal = -cameraNormal;\n #include apply_light_color\n #endif\n\n #include apply_interior_color\n #include apply_marker_color\n #include apply_fog\n #include wboit_write\n #endif\n}\n";
|
|
7
7
|
//# sourceMappingURL=spheres.frag.js.map
|
|
@@ -20,6 +20,7 @@ export interface ShaderExtensions {
|
|
|
20
20
|
declare type FragOutTypes = {
|
|
21
21
|
[k in number]: 'vec4' | 'ivec4';
|
|
22
22
|
};
|
|
23
|
+
declare type IgnoreDefine = (name: string, variant: string, defines: ShaderDefines) => boolean;
|
|
23
24
|
export interface ShaderCode {
|
|
24
25
|
readonly id: number;
|
|
25
26
|
readonly name: string;
|
|
@@ -28,8 +29,9 @@ export interface ShaderCode {
|
|
|
28
29
|
readonly extensions: ShaderExtensions;
|
|
29
30
|
/** Fragment shader output type only applicable for webgl2 */
|
|
30
31
|
readonly outTypes: FragOutTypes;
|
|
32
|
+
readonly ignoreDefine?: IgnoreDefine;
|
|
31
33
|
}
|
|
32
|
-
export declare function ShaderCode(name: string, vert: string, frag: string, extensions?: ShaderExtensions, outTypes?: FragOutTypes): ShaderCode;
|
|
34
|
+
export declare function ShaderCode(name: string, vert: string, frag: string, extensions?: ShaderExtensions, outTypes?: FragOutTypes, ignoreDefine?: IgnoreDefine): ShaderCode;
|
|
33
35
|
export declare const PointsShaderCode: ShaderCode;
|
|
34
36
|
export declare const SpheresShaderCode: ShaderCode;
|
|
35
37
|
export declare const CylindersShaderCode: ShaderCode;
|
|
@@ -110,41 +110,69 @@ function replaceCounts(str, defines) {
|
|
|
110
110
|
function preprocess(str, defines) {
|
|
111
111
|
return unrollLoops(replaceCounts(str, defines));
|
|
112
112
|
}
|
|
113
|
-
export function ShaderCode(name, vert, frag, extensions, outTypes) {
|
|
113
|
+
export function ShaderCode(name, vert, frag, extensions, outTypes, ignoreDefine) {
|
|
114
114
|
if (extensions === void 0) { extensions = {}; }
|
|
115
115
|
if (outTypes === void 0) { outTypes = {}; }
|
|
116
|
-
return { id: shaderCodeId(), name: name, vert: addIncludes(vert), frag: addIncludes(frag), extensions: extensions, outTypes: outTypes };
|
|
116
|
+
return { id: shaderCodeId(), name: name, vert: addIncludes(vert), frag: addIncludes(frag), extensions: extensions, outTypes: outTypes, ignoreDefine: ignoreDefine };
|
|
117
117
|
}
|
|
118
118
|
// Note: `drawBuffers` need to be 'optional' for wboit
|
|
119
|
+
function ignoreDefine(name, variant, defines) {
|
|
120
|
+
var _a;
|
|
121
|
+
if (variant.startsWith('color')) {
|
|
122
|
+
if (name === 'dLightCount') {
|
|
123
|
+
return !!((_a = defines.dIgnoreLight) === null || _a === void 0 ? void 0 : _a.ref.value);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
return [
|
|
128
|
+
'dColorType', 'dUsePalette',
|
|
129
|
+
'dLightCount',
|
|
130
|
+
'dOverpaintType', 'dOverpaint',
|
|
131
|
+
'dSubstanceType', 'dSubstance',
|
|
132
|
+
].includes(name);
|
|
133
|
+
}
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
;
|
|
137
|
+
function ignoreDefineUnlit(name, variant, defines) {
|
|
138
|
+
if (name === 'dLightCount')
|
|
139
|
+
return true;
|
|
140
|
+
return ignoreDefine(name, variant, defines);
|
|
141
|
+
}
|
|
142
|
+
;
|
|
119
143
|
import { points_vert } from './shader/points.vert';
|
|
120
144
|
import { points_frag } from './shader/points.frag';
|
|
121
|
-
export var PointsShaderCode = ShaderCode('points', points_vert, points_frag, { drawBuffers: 'optional' });
|
|
145
|
+
export var PointsShaderCode = ShaderCode('points', points_vert, points_frag, { drawBuffers: 'optional' }, {}, ignoreDefineUnlit);
|
|
122
146
|
import { spheres_vert } from './shader/spheres.vert';
|
|
123
147
|
import { spheres_frag } from './shader/spheres.frag';
|
|
124
|
-
export var SpheresShaderCode = ShaderCode('spheres', spheres_vert, spheres_frag, { fragDepth: 'required', drawBuffers: 'optional' });
|
|
148
|
+
export var SpheresShaderCode = ShaderCode('spheres', spheres_vert, spheres_frag, { fragDepth: 'required', drawBuffers: 'optional' }, {}, ignoreDefine);
|
|
125
149
|
import { cylinders_vert } from './shader/cylinders.vert';
|
|
126
150
|
import { cylinders_frag } from './shader/cylinders.frag';
|
|
127
|
-
export var CylindersShaderCode = ShaderCode('cylinders', cylinders_vert, cylinders_frag, { fragDepth: 'required', drawBuffers: 'optional' });
|
|
151
|
+
export var CylindersShaderCode = ShaderCode('cylinders', cylinders_vert, cylinders_frag, { fragDepth: 'required', drawBuffers: 'optional' }, {}, ignoreDefine);
|
|
128
152
|
import { text_vert } from './shader/text.vert';
|
|
129
153
|
import { text_frag } from './shader/text.frag';
|
|
130
|
-
export var TextShaderCode = ShaderCode('text', text_vert, text_frag, { drawBuffers: 'optional' });
|
|
154
|
+
export var TextShaderCode = ShaderCode('text', text_vert, text_frag, { drawBuffers: 'optional' }, {}, ignoreDefineUnlit);
|
|
131
155
|
import { lines_vert } from './shader/lines.vert';
|
|
132
156
|
import { lines_frag } from './shader/lines.frag';
|
|
133
|
-
export var LinesShaderCode = ShaderCode('lines', lines_vert, lines_frag, { drawBuffers: 'optional' });
|
|
157
|
+
export var LinesShaderCode = ShaderCode('lines', lines_vert, lines_frag, { drawBuffers: 'optional' }, {}, ignoreDefineUnlit);
|
|
134
158
|
import { mesh_vert } from './shader/mesh.vert';
|
|
135
159
|
import { mesh_frag } from './shader/mesh.frag';
|
|
136
|
-
export var MeshShaderCode = ShaderCode('mesh', mesh_vert, mesh_frag, { drawBuffers: 'optional' });
|
|
160
|
+
export var MeshShaderCode = ShaderCode('mesh', mesh_vert, mesh_frag, { drawBuffers: 'optional' }, {}, ignoreDefine);
|
|
137
161
|
import { directVolume_vert } from './shader/direct-volume.vert';
|
|
138
162
|
import { directVolume_frag } from './shader/direct-volume.frag';
|
|
139
|
-
export var DirectVolumeShaderCode = ShaderCode('direct-volume', directVolume_vert, directVolume_frag, { fragDepth: 'optional', drawBuffers: 'optional' });
|
|
163
|
+
export var DirectVolumeShaderCode = ShaderCode('direct-volume', directVolume_vert, directVolume_frag, { fragDepth: 'optional', drawBuffers: 'optional' }, {}, ignoreDefine);
|
|
140
164
|
import { image_vert } from './shader/image.vert';
|
|
141
165
|
import { image_frag } from './shader/image.frag';
|
|
142
|
-
export var ImageShaderCode = ShaderCode('image', image_vert, image_frag, { drawBuffers: 'optional' });
|
|
143
|
-
function getDefinesCode(defines) {
|
|
166
|
+
export var ImageShaderCode = ShaderCode('image', image_vert, image_frag, { drawBuffers: 'optional' }, {}, ignoreDefineUnlit);
|
|
167
|
+
function getDefinesCode(defines, ignore) {
|
|
168
|
+
var _a;
|
|
144
169
|
if (defines === undefined)
|
|
145
170
|
return '';
|
|
171
|
+
var variant = (((_a = defines.dRenderVariant) === null || _a === void 0 ? void 0 : _a.ref.value) || '');
|
|
146
172
|
var lines = [];
|
|
147
173
|
for (var name_1 in defines) {
|
|
174
|
+
if (ignore === null || ignore === void 0 ? void 0 : ignore(name_1, variant, defines))
|
|
175
|
+
continue;
|
|
148
176
|
var define = defines[name_1];
|
|
149
177
|
var v = define.ref.value;
|
|
150
178
|
if (v !== undefined) {
|
|
@@ -229,7 +257,8 @@ function transformGlsl300Frag(frag) {
|
|
|
229
257
|
return frag.replace(/gl_FragData\[([0-9]+)\]/g, 'out_FragData$1');
|
|
230
258
|
}
|
|
231
259
|
export function addShaderDefines(gl, extensions, defines, shaders) {
|
|
232
|
-
var
|
|
260
|
+
var vertHeader = getDefinesCode(defines, shaders.ignoreDefine);
|
|
261
|
+
var fragHeader = getDefinesCode(defines, shaders.ignoreDefine);
|
|
233
262
|
var vertPrefix = isWebGL2(gl) ? glsl300VertPrefix : '';
|
|
234
263
|
var fragPrefix = isWebGL2(gl)
|
|
235
264
|
? getGlsl300FragPrefix(gl, extensions, shaders.extensions, shaders.outTypes)
|
|
@@ -238,8 +267,8 @@ export function addShaderDefines(gl, extensions, defines, shaders) {
|
|
|
238
267
|
return {
|
|
239
268
|
id: shaderCodeId(),
|
|
240
269
|
name: shaders.name,
|
|
241
|
-
vert: "".concat(vertPrefix).concat(
|
|
242
|
-
frag: "".concat(fragPrefix).concat(
|
|
270
|
+
vert: "".concat(vertPrefix).concat(vertHeader).concat(preprocess(shaders.vert, defines)),
|
|
271
|
+
frag: "".concat(fragPrefix).concat(fragHeader).concat(preprocess(frag, defines)),
|
|
243
272
|
extensions: shaders.extensions,
|
|
244
273
|
outTypes: shaders.outTypes
|
|
245
274
|
};
|
|
@@ -21,18 +21,19 @@ export interface RenderItem<T extends string> {
|
|
|
21
21
|
declare const GraphicsRenderVariant: {
|
|
22
22
|
colorBlended: string;
|
|
23
23
|
colorWboit: string;
|
|
24
|
-
|
|
25
|
-
pickInstance: string;
|
|
26
|
-
pickGroup: string;
|
|
24
|
+
pick: string;
|
|
27
25
|
depth: string;
|
|
28
|
-
|
|
29
|
-
markingMask: string;
|
|
26
|
+
marking: string;
|
|
30
27
|
};
|
|
31
28
|
export declare type GraphicsRenderVariant = keyof typeof GraphicsRenderVariant;
|
|
29
|
+
export declare const GraphicsRenderVariants: ("depth" | "colorBlended" | "colorWboit" | "pick" | "marking")[];
|
|
30
|
+
export declare const GraphicsRenderVariantsBlended: ("depth" | "colorBlended" | "colorWboit" | "pick" | "marking")[];
|
|
31
|
+
export declare const GraphicsRenderVariantsWboit: ("depth" | "colorBlended" | "colorWboit" | "pick" | "marking")[];
|
|
32
32
|
declare const ComputeRenderVariant: {
|
|
33
33
|
compute: string;
|
|
34
34
|
};
|
|
35
35
|
export declare type ComputeRenderVariant = keyof typeof ComputeRenderVariant;
|
|
36
|
+
export declare const ComputeRenderVariants: "compute"[];
|
|
36
37
|
declare function createValueChanges(): {
|
|
37
38
|
attributes: boolean;
|
|
38
39
|
defines: boolean;
|
|
@@ -41,7 +42,7 @@ declare function createValueChanges(): {
|
|
|
41
42
|
};
|
|
42
43
|
declare type ValueChanges = ReturnType<typeof createValueChanges>;
|
|
43
44
|
export declare type GraphicsRenderItem = RenderItem<GraphicsRenderVariant>;
|
|
44
|
-
export declare function createGraphicsRenderItem(ctx: WebGLContext, drawMode: DrawMode, shaderCode: ShaderCode, schema: RenderableSchema, values: RenderableValues, materialId: number): RenderItem<"depth" | "colorBlended" | "colorWboit" | "
|
|
45
|
+
export declare function createGraphicsRenderItem(ctx: WebGLContext, drawMode: DrawMode, shaderCode: ShaderCode, schema: RenderableSchema, values: RenderableValues, materialId: number, variants: GraphicsRenderVariant[]): RenderItem<"depth" | "colorBlended" | "colorWboit" | "pick" | "marking">;
|
|
45
46
|
export declare type ComputeRenderItem = RenderItem<ComputeRenderVariant>;
|
|
46
47
|
export declare function createComputeRenderItem(ctx: WebGLContext, drawMode: DrawMode, shaderCode: ShaderCode, schema: RenderableSchema, values: RenderableValues, materialId?: number): RenderItem<"compute">;
|
|
47
48
|
/**
|
|
@@ -29,10 +29,12 @@ export function getDrawMode(ctx, drawMode) {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
//
|
|
32
|
-
var GraphicsRenderVariant = {
|
|
33
|
-
var GraphicsRenderVariants = Object.keys(GraphicsRenderVariant);
|
|
34
|
-
var
|
|
35
|
-
var
|
|
32
|
+
var GraphicsRenderVariant = { colorBlended: '', colorWboit: '', pick: '', depth: '', marking: '' };
|
|
33
|
+
export var GraphicsRenderVariants = Object.keys(GraphicsRenderVariant);
|
|
34
|
+
export var GraphicsRenderVariantsBlended = GraphicsRenderVariants.filter(function (v) { return v !== 'colorWboit'; });
|
|
35
|
+
export var GraphicsRenderVariantsWboit = GraphicsRenderVariants.filter(function (v) { return v !== 'colorBlended'; });
|
|
36
|
+
var ComputeRenderVariant = { compute: '' };
|
|
37
|
+
export var ComputeRenderVariants = Object.keys(ComputeRenderVariant);
|
|
36
38
|
function createProgramVariant(ctx, variant, defineValues, shaderCode, schema) {
|
|
37
39
|
defineValues = __assign(__assign({}, defineValues), { dRenderVariant: ValueCell.create(variant) });
|
|
38
40
|
if (schema.dRenderVariant === undefined) {
|
|
@@ -54,8 +56,8 @@ function resetValueChanges(valueChanges) {
|
|
|
54
56
|
valueChanges.elements = false;
|
|
55
57
|
valueChanges.textures = false;
|
|
56
58
|
}
|
|
57
|
-
export function createGraphicsRenderItem(ctx, drawMode, shaderCode, schema, values, materialId) {
|
|
58
|
-
return createRenderItem(ctx, drawMode, shaderCode, schema, values, materialId,
|
|
59
|
+
export function createGraphicsRenderItem(ctx, drawMode, shaderCode, schema, values, materialId, variants) {
|
|
60
|
+
return createRenderItem(ctx, drawMode, shaderCode, schema, values, materialId, variants);
|
|
59
61
|
}
|
|
60
62
|
export function createComputeRenderItem(ctx, drawMode, shaderCode, schema, values, materialId) {
|
|
61
63
|
if (materialId === void 0) { materialId = -1; }
|