molstar 3.8.2 → 3.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/viewer/index.html +4 -1
- package/build/viewer/molstar.js +1 -1
- package/lib/apps/viewer/app.d.ts +1 -1
- package/lib/apps/viewer/app.js +1 -1
- package/lib/apps/viewer/index.html +4 -1
- package/lib/cli/cif2bcif/converter.js +1 -1
- package/lib/commonjs/apps/viewer/app.d.ts +1 -1
- package/lib/commonjs/apps/viewer/app.js +2 -1
- package/lib/commonjs/cli/cif2bcif/converter.js +1 -1
- package/lib/commonjs/examples/alpha-orbitals/index.d.ts +1 -1
- package/lib/commonjs/examples/alpha-orbitals/index.js +4 -1
- package/lib/commonjs/examples/basic-wrapper/custom-theme.js +1 -1
- package/lib/commonjs/examples/proteopedia-wrapper/coloring.js +3 -3
- package/lib/commonjs/extensions/alpha-orbitals/density.d.ts +1 -1
- package/lib/commonjs/extensions/alpha-orbitals/density.js +6 -2
- package/lib/commonjs/extensions/alpha-orbitals/orbitals.d.ts +1 -1
- package/lib/commonjs/extensions/alpha-orbitals/orbitals.js +6 -3
- package/lib/commonjs/extensions/anvil/algorithm.js +1 -1
- package/lib/commonjs/extensions/cellpack/color/generate.js +1 -1
- package/lib/commonjs/extensions/cellpack/color/provided.js +1 -1
- package/lib/commonjs/extensions/cellpack/state.js +1 -1
- package/lib/commonjs/extensions/dnatco/confal-pyramids/color.js +1 -1
- package/lib/commonjs/extensions/g3d/model.js +1 -1
- package/lib/commonjs/extensions/model-archive/quality-assessment/color/plddt.js +1 -1
- package/lib/commonjs/extensions/model-archive/quality-assessment/color/qmean.js +1 -1
- package/lib/commonjs/extensions/pdbe/structure-quality-report/color.js +1 -1
- package/lib/commonjs/extensions/rcsb/assembly-symmetry/color.js +4 -4
- package/lib/commonjs/extensions/rcsb/validation-report/color/density-fit.js +1 -1
- package/lib/commonjs/extensions/rcsb/validation-report/color/geometry-quality.js +2 -2
- package/lib/commonjs/extensions/rcsb/validation-report/color/random-coil-index.js +1 -1
- package/lib/commonjs/extensions/rcsb/validation-report/representation.js +2 -2
- package/lib/commonjs/mol-canvas3d/canvas3d.js +4 -0
- package/lib/commonjs/mol-canvas3d/controls/trackball.js +7 -7
- package/lib/commonjs/mol-canvas3d/helper/camera-helper.js +14 -14
- package/lib/commonjs/mol-canvas3d/helper/interaction-events.js +5 -5
- package/lib/commonjs/mol-canvas3d/passes/draw.js +34 -5
- package/lib/commonjs/mol-canvas3d/passes/fxaa.js +5 -0
- package/lib/commonjs/mol-canvas3d/passes/marking.js +5 -0
- package/lib/commonjs/mol-canvas3d/passes/multi-sample.js +9 -0
- package/lib/commonjs/mol-canvas3d/passes/pick.d.ts +18 -5
- package/lib/commonjs/mol-canvas3d/passes/pick.js +125 -24
- package/lib/commonjs/mol-canvas3d/passes/postprocessing.js +5 -0
- package/lib/commonjs/mol-canvas3d/passes/smaa.js +4 -0
- package/lib/commonjs/mol-canvas3d/passes/wboit.js +4 -0
- package/lib/commonjs/mol-data/db/column.js +5 -5
- package/lib/commonjs/mol-data/db/table.js +2 -2
- package/lib/commonjs/mol-data/util/array.d.ts +1 -1
- package/lib/commonjs/mol-geo/geometry/texture-mesh/color-smoothing.js +13 -0
- package/lib/commonjs/mol-gl/compute/grid3d.d.ts +2 -2
- package/lib/commonjs/mol-gl/compute/grid3d.js +30 -8
- package/lib/commonjs/mol-gl/compute/histogram-pyramid/reduction.d.ts +1 -1
- package/lib/commonjs/mol-gl/compute/histogram-pyramid/reduction.js +6 -1
- package/lib/commonjs/mol-gl/compute/histogram-pyramid/sum.d.ts +1 -1
- package/lib/commonjs/mol-gl/compute/histogram-pyramid/sum.js +6 -1
- package/lib/commonjs/mol-gl/compute/marching-cubes/active-voxels.d.ts +1 -1
- package/lib/commonjs/mol-gl/compute/marching-cubes/active-voxels.js +6 -1
- package/lib/commonjs/mol-gl/compute/marching-cubes/isosurface.d.ts +1 -1
- package/lib/commonjs/mol-gl/compute/marching-cubes/isosurface.js +10 -10
- package/lib/commonjs/mol-gl/renderer.js +77 -32
- package/lib/commonjs/mol-gl/scene.js +2 -0
- 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-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/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/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/image.frag.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/image.frag.js +1 -1
- package/lib/commonjs/mol-gl/shader/lines.frag.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/lines.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/points.frag.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/points.frag.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/text.frag.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/text.frag.js +1 -1
- package/lib/commonjs/mol-gl/shader-code.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader-code.js +41 -9
- package/lib/commonjs/mol-gl/webgl/compat.d.ts +34 -1
- package/lib/commonjs/mol-gl/webgl/compat.js +50 -2
- package/lib/commonjs/mol-gl/webgl/context.d.ts +2 -0
- package/lib/commonjs/mol-gl/webgl/context.js +3 -0
- package/lib/commonjs/mol-gl/webgl/extensions.d.ts +3 -2
- package/lib/commonjs/mol-gl/webgl/extensions.js +6 -1
- package/lib/commonjs/mol-gl/webgl/timer.d.ts +22 -0
- package/lib/commonjs/mol-gl/webgl/timer.js +169 -0
- package/lib/commonjs/mol-io/common/binary-cif/array-encoder.js +18 -18
- package/lib/commonjs/mol-io/common/binary-cif/decoder.js +16 -16
- package/lib/commonjs/mol-io/common/binary-cif/encoding.js +9 -9
- package/lib/commonjs/mol-io/reader/cif/binary/field.js +3 -3
- package/lib/commonjs/mol-io/reader/cif/data-model.js +14 -14
- package/lib/commonjs/mol-io/reader/cif/schema.js +1 -1
- package/lib/commonjs/mol-io/reader/cif/text/parser.js +23 -23
- package/lib/commonjs/mol-io/reader/common/text/column/fixed.js +1 -1
- package/lib/commonjs/mol-io/reader/common/text/column/token.js +1 -1
- package/lib/commonjs/mol-io/reader/common/text/number-parser.js +6 -6
- package/lib/commonjs/mol-io/reader/csv/parser.js +8 -8
- package/lib/commonjs/mol-io/writer/cif/encoder/binary.js +10 -10
- package/lib/commonjs/mol-io/writer/cif/encoder/text.js +7 -7
- package/lib/commonjs/mol-io/writer/cif/encoder.js +8 -8
- package/lib/commonjs/mol-io/writer/mol2/encoder.js +4 -4
- package/lib/commonjs/mol-math/geometry/gaussian-density/gpu.js +13 -2
- package/lib/commonjs/mol-model/sequence/alignment/sequence.js +3 -3
- package/lib/commonjs/mol-model/sequence/sequence.js +9 -9
- package/lib/commonjs/mol-model/structure/export/categories/atom_site_operator_mapping.js +3 -3
- package/lib/commonjs/mol-model/structure/export/categories/secondary-structure.js +2 -2
- package/lib/commonjs/mol-model/structure/export/categories/utils.js +1 -1
- package/lib/commonjs/mol-model/structure/model/model.js +2 -2
- package/lib/commonjs/mol-model/structure/model/properties/custom/indexed.js +6 -6
- package/lib/commonjs/mol-model/structure/model/properties/utils/atomic-ranges.js +1 -1
- package/lib/commonjs/mol-model/structure/model/types.js +116 -116
- package/lib/commonjs/mol-model/structure/query/context.js +1 -1
- package/lib/commonjs/mol-model/structure/query/queries/generators.js +5 -5
- package/lib/commonjs/mol-model/structure/query/queries/internal.js +4 -4
- package/lib/commonjs/mol-model/structure/query/queries/modifiers.js +4 -4
- package/lib/commonjs/mol-model/structure/query/utils/structure-distance.d.ts +5 -54
- package/lib/commonjs/mol-model/structure/query/utils/structure-distance.js +9 -9
- package/lib/commonjs/mol-model/structure/structure/carbohydrates/constants.js +106 -106
- package/lib/commonjs/mol-model/structure/structure/element/loci.js +5 -5
- package/lib/commonjs/mol-model/structure/structure/element/stats.js +5 -5
- package/lib/commonjs/mol-model/structure/structure/properties.js +5 -5
- package/lib/commonjs/mol-model/structure/structure/structure.js +11 -11
- package/lib/commonjs/mol-model/structure/structure/unit/bonds/inter-compute.js +5 -5
- package/lib/commonjs/mol-model/structure/structure/unit/bonds/intra-compute.js +4 -4
- package/lib/commonjs/mol-model/structure/structure/unit/bonds.js +2 -2
- package/lib/commonjs/mol-model/structure/structure/unit/resonance.js +1 -1
- package/lib/commonjs/mol-model/structure/structure/unit/rings/compute.js +6 -6
- package/lib/commonjs/mol-model/structure/structure/unit/rings.js +6 -6
- package/lib/commonjs/mol-model/structure/structure/unit.js +16 -16
- package/lib/commonjs/mol-model/structure/structure/util/superposition-sifts-mapping.js +1 -1
- package/lib/commonjs/mol-model/structure/util.js +4 -4
- package/lib/commonjs/mol-model-formats/structure/basic/atomic.js +2 -2
- package/lib/commonjs/mol-model-formats/structure/basic/parser.js +4 -4
- package/lib/commonjs/mol-model-formats/structure/basic/properties.js +1 -1
- package/lib/commonjs/mol-model-formats/structure/basic/sort.js +1 -1
- package/lib/commonjs/mol-model-formats/structure/basic/util.js +1 -1
- package/lib/commonjs/mol-model-formats/structure/cif-core.js +6 -6
- package/lib/commonjs/mol-model-formats/structure/common/entity.js +1 -1
- package/lib/commonjs/mol-model-formats/structure/cube.js +1 -1
- package/lib/commonjs/mol-model-formats/structure/gro.js +1 -1
- package/lib/commonjs/mol-model-formats/structure/mol.js +1 -1
- package/lib/commonjs/mol-model-formats/structure/mol2.js +4 -4
- package/lib/commonjs/mol-model-formats/structure/prmtop.js +1 -1
- package/lib/commonjs/mol-model-formats/structure/property/bonds/chem_comp.js +3 -3
- package/lib/commonjs/mol-model-formats/structure/property/bonds/index-pair.js +1 -1
- package/lib/commonjs/mol-model-formats/structure/property/bonds/struct_conn.js +6 -6
- package/lib/commonjs/mol-model-formats/structure/property/secondary-structure.js +8 -8
- package/lib/commonjs/mol-model-formats/structure/psf.js +1 -1
- package/lib/commonjs/mol-model-formats/structure/top.js +1 -1
- package/lib/commonjs/mol-model-formats/structure/xyz.js +1 -1
- package/lib/commonjs/mol-model-props/computed/accessible-surface-area/shrake-rupley/radii.js +2 -2
- package/lib/commonjs/mol-model-props/computed/accessible-surface-area/shrake-rupley.js +3 -3
- package/lib/commonjs/mol-model-props/computed/accessible-surface-area.js +2 -2
- package/lib/commonjs/mol-model-props/computed/chemistry/functional-group.js +31 -31
- package/lib/commonjs/mol-model-props/computed/chemistry/geometry.js +22 -22
- package/lib/commonjs/mol-model-props/computed/chemistry/valence-model.js +32 -32
- package/lib/commonjs/mol-model-props/computed/interactions/charged.js +39 -39
- package/lib/commonjs/mol-model-props/computed/interactions/common.js +34 -34
- package/lib/commonjs/mol-model-props/computed/interactions/contacts-builder.js +1 -1
- package/lib/commonjs/mol-model-props/computed/interactions/contacts.js +1 -1
- package/lib/commonjs/mol-model-props/computed/interactions/halogen-bonds.js +12 -12
- package/lib/commonjs/mol-model-props/computed/interactions/hydrogen-bonds.js +32 -32
- package/lib/commonjs/mol-model-props/computed/interactions/hydrophobic.js +9 -9
- package/lib/commonjs/mol-model-props/computed/interactions/metal.js +26 -26
- package/lib/commonjs/mol-model-props/computed/interactions/refine.js +20 -20
- package/lib/commonjs/mol-model-props/computed/representations/interactions-inter-unit-cylinder.js +2 -2
- package/lib/commonjs/mol-model-props/computed/representations/interactions-intra-unit-cylinder.js +2 -2
- package/lib/commonjs/mol-model-props/computed/secondary-structure/dssp/bends.js +1 -1
- package/lib/commonjs/mol-model-props/computed/secondary-structure/dssp/bridges.js +12 -12
- package/lib/commonjs/mol-model-props/computed/secondary-structure/dssp/helices.js +6 -6
- package/lib/commonjs/mol-model-props/computed/secondary-structure/dssp/ladders.js +3 -3
- package/lib/commonjs/mol-model-props/computed/secondary-structure/dssp/sheets.js +11 -11
- package/lib/commonjs/mol-model-props/computed/secondary-structure/dssp/turns.js +3 -3
- package/lib/commonjs/mol-model-props/computed/secondary-structure/dssp.js +30 -30
- package/lib/commonjs/mol-model-props/computed/themes/accessible-surface-area.js +1 -1
- package/lib/commonjs/mol-model-props/computed/themes/interaction-type.js +10 -10
- package/lib/commonjs/mol-model-props/integrative/cross-link-restraint/color.js +1 -1
- package/lib/commonjs/mol-model-props/integrative/cross-link-restraint/format.js +3 -3
- package/lib/commonjs/mol-model-props/sequence/sifts-mapping.js +1 -1
- package/lib/commonjs/mol-model-props/sequence/themes/sifts-mapping.js +1 -1
- package/lib/commonjs/mol-plugin/animation-loop.d.ts +2 -1
- package/lib/commonjs/mol-plugin/animation-loop.js +18 -5
- package/lib/commonjs/mol-plugin/behavior/dynamic/camera.js +12 -12
- package/lib/commonjs/mol-plugin/behavior/dynamic/representation.js +7 -7
- package/lib/commonjs/mol-plugin/context.d.ts +2 -2
- package/lib/commonjs/mol-plugin/state.d.ts +1 -14
- package/lib/commonjs/mol-plugin-state/formats/volume.d.ts +12 -11
- package/lib/commonjs/mol-plugin-state/formats/volume.js +20 -13
- package/lib/commonjs/mol-plugin-state/helpers/structure-selection-query.js +5 -5
- package/lib/commonjs/mol-plugin-state/transforms/representation.js +2 -2
- package/lib/commonjs/mol-plugin-ui/controls/parameters.d.ts +1 -1
- package/lib/commonjs/mol-plugin-ui/sequence/polymer.js +1 -1
- package/lib/commonjs/mol-plugin-ui/sequence/sequence.js +1 -1
- package/lib/commonjs/mol-plugin-ui/structure/focus.js +1 -1
- package/lib/commonjs/mol-plugin-ui/viewport.d.ts +2 -2
- package/lib/commonjs/mol-repr/structure/visual/bond-inter-unit-cylinder.js +10 -10
- package/lib/commonjs/mol-repr/structure/visual/bond-inter-unit-line.js +10 -10
- package/lib/commonjs/mol-repr/structure/visual/bond-intra-unit-cylinder.js +12 -12
- package/lib/commonjs/mol-repr/structure/visual/bond-intra-unit-line.js +12 -12
- package/lib/commonjs/mol-repr/structure/visual/carbohydrate-symbol-mesh.js +16 -16
- package/lib/commonjs/mol-repr/structure/visual/carbohydrate-terminal-link-cylinder.js +1 -1
- package/lib/commonjs/mol-repr/structure/visual/gaussian-surface-mesh.js +9 -0
- package/lib/commonjs/mol-repr/structure/visual/orientation-ellipsoid-mesh.js +4 -4
- package/lib/commonjs/mol-repr/structure/visual/polymer-direction-wedge.js +1 -1
- package/lib/commonjs/mol-repr/structure/visual/polymer-trace-mesh.js +2 -2
- package/lib/commonjs/mol-repr/structure/visual/util/bond.js +2 -2
- package/lib/commonjs/mol-repr/structure/visual/util/common.js +3 -3
- package/lib/commonjs/mol-repr/structure/visual/util/link.js +30 -30
- package/lib/commonjs/mol-repr/structure/visual/util/polymer/backbone.js +6 -6
- package/lib/commonjs/mol-repr/structure/visual/util/polymer/gap-iterator.js +3 -3
- package/lib/commonjs/mol-repr/structure/visual/util/polymer/trace-iterator.js +20 -20
- package/lib/commonjs/mol-repr/structure/visual/util/polymer.js +6 -6
- package/lib/commonjs/mol-script/language/symbol-table/core.d.ts +2 -2
- package/lib/commonjs/mol-script/runtime/query/table.js +13 -13
- package/lib/commonjs/mol-state/object.d.ts +3 -3
- package/lib/commonjs/mol-task/util/user-timing.js +1 -1
- package/lib/commonjs/mol-theme/clipping.js +19 -19
- package/lib/commonjs/mol-theme/color/atom-id.js +1 -1
- package/lib/commonjs/mol-theme/color/carbohydrate-symbol.js +1 -1
- package/lib/commonjs/mol-theme/color/chain-id.js +4 -4
- package/lib/commonjs/mol-theme/color/element-index.js +1 -1
- package/lib/commonjs/mol-theme/color/element-symbol.js +1 -1
- package/lib/commonjs/mol-theme/color/entity-id.js +4 -4
- package/lib/commonjs/mol-theme/color/entity-source.js +5 -4
- package/lib/commonjs/mol-theme/color/hydrophobicity.js +1 -1
- package/lib/commonjs/mol-theme/color/illustrative.js +1 -1
- package/lib/commonjs/mol-theme/color/model-index.js +1 -1
- package/lib/commonjs/mol-theme/color/molecule-type.js +8 -8
- package/lib/commonjs/mol-theme/color/occupancy.js +1 -1
- package/lib/commonjs/mol-theme/color/operator-hkl.js +1 -1
- package/lib/commonjs/mol-theme/color/operator-name.js +1 -1
- package/lib/commonjs/mol-theme/color/partial-charge.js +1 -1
- package/lib/commonjs/mol-theme/color/polymer-id.js +4 -4
- package/lib/commonjs/mol-theme/color/polymer-index.js +1 -1
- package/lib/commonjs/mol-theme/color/residue-name.js +1 -1
- package/lib/commonjs/mol-theme/color/secondary-structure.js +12 -12
- package/lib/commonjs/mol-theme/color/sequence-id.js +7 -7
- package/lib/commonjs/mol-theme/color/shape-group.js +1 -1
- package/lib/commonjs/mol-theme/color/uncertainty.js +1 -1
- package/lib/commonjs/mol-theme/color/uniform.js +1 -1
- package/lib/commonjs/mol-theme/color/unit-index.js +1 -1
- package/lib/commonjs/mol-theme/color/volume-value.js +1 -1
- package/lib/commonjs/mol-theme/label.js +3 -3
- package/lib/commonjs/mol-util/binding.js +4 -4
- package/lib/commonjs/mol-util/debug.d.ts +6 -1
- package/lib/commonjs/mol-util/debug.js +11 -1
- package/lib/commonjs/mol-util/input/input-observer.js +20 -20
- package/lib/commonjs/mol-util/string-builder.js +1 -1
- package/lib/commonjs/servers/model/preprocess/converter.js +1 -1
- package/lib/commonjs/servers/model/server/query.js +1 -1
- package/lib/commonjs/servers/model/utils/fetch-retry.js +3 -2
- package/lib/commonjs/servers/volume/server/algebra/coordinate.js +6 -6
- package/lib/commonjs/servers/volume/server/query/encode.js +1 -1
- package/lib/examples/alpha-orbitals/index.d.ts +1 -1
- package/lib/examples/alpha-orbitals/index.html +11 -0
- package/lib/examples/alpha-orbitals/index.js +4 -1
- package/lib/examples/basic-wrapper/custom-theme.js +1 -1
- package/lib/examples/proteopedia-wrapper/coloring.js +3 -3
- package/lib/extensions/alpha-orbitals/density.d.ts +1 -1
- package/lib/extensions/alpha-orbitals/density.js +6 -2
- package/lib/extensions/alpha-orbitals/orbitals.d.ts +1 -1
- package/lib/extensions/alpha-orbitals/orbitals.js +6 -3
- package/lib/extensions/anvil/algorithm.js +1 -1
- package/lib/extensions/cellpack/color/generate.js +1 -1
- package/lib/extensions/cellpack/color/provided.js +1 -1
- package/lib/extensions/cellpack/state.js +1 -1
- package/lib/extensions/dnatco/confal-pyramids/color.js +1 -1
- package/lib/extensions/g3d/model.js +1 -1
- package/lib/extensions/model-archive/quality-assessment/color/plddt.js +1 -1
- package/lib/extensions/model-archive/quality-assessment/color/qmean.js +1 -1
- package/lib/extensions/pdbe/structure-quality-report/color.js +1 -1
- package/lib/extensions/rcsb/assembly-symmetry/color.js +4 -4
- package/lib/extensions/rcsb/validation-report/color/density-fit.js +1 -1
- package/lib/extensions/rcsb/validation-report/color/geometry-quality.js +2 -2
- package/lib/extensions/rcsb/validation-report/color/random-coil-index.js +1 -1
- package/lib/extensions/rcsb/validation-report/representation.js +2 -2
- package/lib/mol-canvas3d/canvas3d.js +5 -1
- package/lib/mol-canvas3d/controls/trackball.js +7 -7
- package/lib/mol-canvas3d/helper/camera-helper.js +14 -14
- package/lib/mol-canvas3d/helper/interaction-events.js +5 -5
- package/lib/mol-canvas3d/passes/draw.js +34 -5
- package/lib/mol-canvas3d/passes/fxaa.js +5 -0
- package/lib/mol-canvas3d/passes/marking.js +5 -0
- package/lib/mol-canvas3d/passes/multi-sample.js +9 -0
- package/lib/mol-canvas3d/passes/pick.d.ts +18 -5
- package/lib/mol-canvas3d/passes/pick.js +125 -24
- package/lib/mol-canvas3d/passes/postprocessing.js +5 -0
- package/lib/mol-canvas3d/passes/smaa.js +5 -1
- package/lib/mol-canvas3d/passes/wboit.js +5 -1
- package/lib/mol-data/db/column.js +5 -5
- package/lib/mol-data/db/table.js +2 -2
- package/lib/mol-data/util/array.d.ts +1 -1
- package/lib/mol-geo/geometry/texture-mesh/color-smoothing.js +13 -0
- package/lib/mol-gl/compute/grid3d.d.ts +2 -2
- package/lib/mol-gl/compute/grid3d.js +30 -8
- package/lib/mol-gl/compute/histogram-pyramid/reduction.d.ts +1 -1
- package/lib/mol-gl/compute/histogram-pyramid/reduction.js +6 -1
- package/lib/mol-gl/compute/histogram-pyramid/sum.d.ts +1 -1
- package/lib/mol-gl/compute/histogram-pyramid/sum.js +6 -1
- package/lib/mol-gl/compute/marching-cubes/active-voxels.d.ts +1 -1
- package/lib/mol-gl/compute/marching-cubes/active-voxels.js +6 -1
- package/lib/mol-gl/compute/marching-cubes/isosurface.d.ts +1 -1
- package/lib/mol-gl/compute/marching-cubes/isosurface.js +10 -10
- package/lib/mol-gl/renderer.js +77 -32
- package/lib/mol-gl/scene.js +2 -0
- 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-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/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/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/image.frag.d.ts +1 -1
- package/lib/mol-gl/shader/image.frag.js +1 -1
- package/lib/mol-gl/shader/lines.frag.d.ts +1 -1
- package/lib/mol-gl/shader/lines.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/points.frag.d.ts +1 -1
- package/lib/mol-gl/shader/points.frag.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/text.frag.d.ts +1 -1
- package/lib/mol-gl/shader/text.frag.js +1 -1
- package/lib/mol-gl/shader-code.d.ts +1 -1
- package/lib/mol-gl/shader-code.js +41 -9
- package/lib/mol-gl/webgl/compat.d.ts +34 -1
- package/lib/mol-gl/webgl/compat.js +48 -1
- package/lib/mol-gl/webgl/context.d.ts +2 -0
- package/lib/mol-gl/webgl/context.js +3 -0
- package/lib/mol-gl/webgl/extensions.d.ts +3 -2
- package/lib/mol-gl/webgl/extensions.js +7 -2
- package/lib/mol-gl/webgl/timer.d.ts +22 -0
- package/lib/mol-gl/webgl/timer.js +164 -0
- package/lib/mol-io/common/binary-cif/array-encoder.js +18 -18
- package/lib/mol-io/common/binary-cif/decoder.js +16 -16
- package/lib/mol-io/common/binary-cif/encoding.js +9 -9
- package/lib/mol-io/reader/cif/binary/field.js +3 -3
- package/lib/mol-io/reader/cif/data-model.js +14 -14
- package/lib/mol-io/reader/cif/schema.js +1 -1
- package/lib/mol-io/reader/cif/text/parser.js +23 -23
- package/lib/mol-io/reader/common/text/column/fixed.js +1 -1
- package/lib/mol-io/reader/common/text/column/token.js +1 -1
- package/lib/mol-io/reader/common/text/number-parser.js +6 -6
- package/lib/mol-io/reader/csv/parser.js +8 -8
- package/lib/mol-io/writer/cif/encoder/binary.js +10 -10
- package/lib/mol-io/writer/cif/encoder/text.js +7 -7
- package/lib/mol-io/writer/cif/encoder.js +8 -8
- package/lib/mol-io/writer/mol2/encoder.js +4 -4
- package/lib/mol-math/geometry/gaussian-density/gpu.js +13 -2
- package/lib/mol-model/sequence/alignment/sequence.js +3 -3
- package/lib/mol-model/sequence/sequence.js +9 -9
- package/lib/mol-model/structure/export/categories/atom_site_operator_mapping.js +3 -3
- package/lib/mol-model/structure/export/categories/secondary-structure.js +2 -2
- package/lib/mol-model/structure/export/categories/utils.js +1 -1
- package/lib/mol-model/structure/model/model.js +2 -2
- package/lib/mol-model/structure/model/properties/custom/indexed.js +6 -6
- package/lib/mol-model/structure/model/properties/utils/atomic-ranges.js +1 -1
- package/lib/mol-model/structure/model/types.js +116 -116
- package/lib/mol-model/structure/query/context.js +1 -1
- package/lib/mol-model/structure/query/queries/generators.js +5 -5
- package/lib/mol-model/structure/query/queries/internal.js +4 -4
- package/lib/mol-model/structure/query/queries/modifiers.js +4 -4
- package/lib/mol-model/structure/query/utils/structure-distance.d.ts +5 -54
- package/lib/mol-model/structure/query/utils/structure-distance.js +9 -9
- package/lib/mol-model/structure/structure/carbohydrates/constants.js +106 -106
- package/lib/mol-model/structure/structure/element/loci.js +5 -5
- package/lib/mol-model/structure/structure/element/stats.js +5 -5
- package/lib/mol-model/structure/structure/properties.js +5 -5
- package/lib/mol-model/structure/structure/structure.js +11 -11
- package/lib/mol-model/structure/structure/unit/bonds/inter-compute.js +5 -5
- package/lib/mol-model/structure/structure/unit/bonds/intra-compute.js +4 -4
- package/lib/mol-model/structure/structure/unit/bonds.js +2 -2
- package/lib/mol-model/structure/structure/unit/resonance.js +1 -1
- package/lib/mol-model/structure/structure/unit/rings/compute.js +6 -6
- package/lib/mol-model/structure/structure/unit/rings.js +6 -6
- package/lib/mol-model/structure/structure/unit.js +16 -16
- package/lib/mol-model/structure/structure/util/superposition-sifts-mapping.js +1 -1
- package/lib/mol-model/structure/util.js +4 -4
- package/lib/mol-model-formats/structure/basic/atomic.js +2 -2
- package/lib/mol-model-formats/structure/basic/parser.js +4 -4
- package/lib/mol-model-formats/structure/basic/properties.js +1 -1
- package/lib/mol-model-formats/structure/basic/sort.js +1 -1
- package/lib/mol-model-formats/structure/basic/util.js +1 -1
- package/lib/mol-model-formats/structure/cif-core.js +6 -6
- package/lib/mol-model-formats/structure/common/entity.js +1 -1
- package/lib/mol-model-formats/structure/cube.js +1 -1
- package/lib/mol-model-formats/structure/gro.js +1 -1
- package/lib/mol-model-formats/structure/mol.js +1 -1
- package/lib/mol-model-formats/structure/mol2.js +4 -4
- package/lib/mol-model-formats/structure/prmtop.js +1 -1
- package/lib/mol-model-formats/structure/property/bonds/chem_comp.js +3 -3
- package/lib/mol-model-formats/structure/property/bonds/index-pair.js +1 -1
- package/lib/mol-model-formats/structure/property/bonds/struct_conn.js +6 -6
- package/lib/mol-model-formats/structure/property/secondary-structure.js +8 -8
- package/lib/mol-model-formats/structure/psf.js +1 -1
- package/lib/mol-model-formats/structure/top.js +1 -1
- package/lib/mol-model-formats/structure/xyz.js +1 -1
- package/lib/mol-model-props/computed/accessible-surface-area/shrake-rupley/radii.js +2 -2
- package/lib/mol-model-props/computed/accessible-surface-area/shrake-rupley.js +3 -3
- package/lib/mol-model-props/computed/accessible-surface-area.js +2 -2
- package/lib/mol-model-props/computed/chemistry/functional-group.js +31 -31
- package/lib/mol-model-props/computed/chemistry/geometry.js +22 -22
- package/lib/mol-model-props/computed/chemistry/valence-model.js +32 -32
- package/lib/mol-model-props/computed/interactions/charged.js +39 -39
- package/lib/mol-model-props/computed/interactions/common.js +34 -34
- package/lib/mol-model-props/computed/interactions/contacts-builder.js +1 -1
- package/lib/mol-model-props/computed/interactions/contacts.js +1 -1
- package/lib/mol-model-props/computed/interactions/halogen-bonds.js +12 -12
- package/lib/mol-model-props/computed/interactions/hydrogen-bonds.js +32 -32
- package/lib/mol-model-props/computed/interactions/hydrophobic.js +9 -9
- package/lib/mol-model-props/computed/interactions/metal.js +26 -26
- package/lib/mol-model-props/computed/interactions/refine.js +20 -20
- package/lib/mol-model-props/computed/representations/interactions-inter-unit-cylinder.js +2 -2
- package/lib/mol-model-props/computed/representations/interactions-intra-unit-cylinder.js +2 -2
- package/lib/mol-model-props/computed/secondary-structure/dssp/bends.js +1 -1
- package/lib/mol-model-props/computed/secondary-structure/dssp/bridges.js +12 -12
- package/lib/mol-model-props/computed/secondary-structure/dssp/helices.js +6 -6
- package/lib/mol-model-props/computed/secondary-structure/dssp/ladders.js +3 -3
- package/lib/mol-model-props/computed/secondary-structure/dssp/sheets.js +11 -11
- package/lib/mol-model-props/computed/secondary-structure/dssp/turns.js +3 -3
- package/lib/mol-model-props/computed/secondary-structure/dssp.js +30 -30
- package/lib/mol-model-props/computed/themes/accessible-surface-area.js +1 -1
- package/lib/mol-model-props/computed/themes/interaction-type.js +10 -10
- package/lib/mol-model-props/integrative/cross-link-restraint/color.js +1 -1
- package/lib/mol-model-props/integrative/cross-link-restraint/format.js +3 -3
- package/lib/mol-model-props/sequence/sifts-mapping.js +1 -1
- package/lib/mol-model-props/sequence/themes/sifts-mapping.js +1 -1
- package/lib/mol-plugin/animation-loop.d.ts +2 -1
- package/lib/mol-plugin/animation-loop.js +18 -5
- package/lib/mol-plugin/behavior/dynamic/camera.js +12 -12
- package/lib/mol-plugin/behavior/dynamic/representation.js +7 -7
- package/lib/mol-plugin/context.d.ts +2 -2
- package/lib/mol-plugin/state.d.ts +1 -14
- package/lib/mol-plugin/version.js +2 -2
- package/lib/mol-plugin-state/formats/volume.d.ts +12 -11
- package/lib/mol-plugin-state/formats/volume.js +20 -13
- package/lib/mol-plugin-state/helpers/structure-selection-query.js +5 -5
- package/lib/mol-plugin-state/transforms/representation.js +2 -2
- package/lib/mol-plugin-ui/controls/parameters.d.ts +1 -1
- package/lib/mol-plugin-ui/sequence/polymer.js +1 -1
- package/lib/mol-plugin-ui/sequence/sequence.js +1 -1
- package/lib/mol-plugin-ui/structure/focus.js +1 -1
- package/lib/mol-plugin-ui/viewport.d.ts +2 -2
- package/lib/mol-repr/structure/visual/bond-inter-unit-cylinder.js +10 -10
- package/lib/mol-repr/structure/visual/bond-inter-unit-line.js +10 -10
- package/lib/mol-repr/structure/visual/bond-intra-unit-cylinder.js +12 -12
- package/lib/mol-repr/structure/visual/bond-intra-unit-line.js +12 -12
- package/lib/mol-repr/structure/visual/carbohydrate-symbol-mesh.js +16 -16
- package/lib/mol-repr/structure/visual/carbohydrate-terminal-link-cylinder.js +1 -1
- package/lib/mol-repr/structure/visual/gaussian-surface-mesh.js +9 -0
- package/lib/mol-repr/structure/visual/orientation-ellipsoid-mesh.js +4 -4
- package/lib/mol-repr/structure/visual/polymer-direction-wedge.js +1 -1
- package/lib/mol-repr/structure/visual/polymer-trace-mesh.js +2 -2
- package/lib/mol-repr/structure/visual/util/bond.js +2 -2
- package/lib/mol-repr/structure/visual/util/common.js +3 -3
- package/lib/mol-repr/structure/visual/util/link.js +30 -30
- package/lib/mol-repr/structure/visual/util/polymer/backbone.js +6 -6
- package/lib/mol-repr/structure/visual/util/polymer/gap-iterator.js +3 -3
- package/lib/mol-repr/structure/visual/util/polymer/trace-iterator.js +20 -20
- package/lib/mol-repr/structure/visual/util/polymer.js +6 -6
- package/lib/mol-script/language/symbol-table/core.d.ts +2 -2
- package/lib/mol-script/runtime/query/table.js +13 -13
- package/lib/mol-state/object.d.ts +3 -3
- package/lib/mol-task/util/user-timing.js +1 -1
- package/lib/mol-theme/clipping.js +19 -19
- package/lib/mol-theme/color/atom-id.js +1 -1
- package/lib/mol-theme/color/carbohydrate-symbol.js +1 -1
- package/lib/mol-theme/color/chain-id.js +4 -4
- package/lib/mol-theme/color/element-index.js +1 -1
- package/lib/mol-theme/color/element-symbol.js +1 -1
- package/lib/mol-theme/color/entity-id.js +4 -4
- package/lib/mol-theme/color/entity-source.js +5 -4
- package/lib/mol-theme/color/hydrophobicity.js +1 -1
- package/lib/mol-theme/color/illustrative.js +1 -1
- package/lib/mol-theme/color/model-index.js +1 -1
- package/lib/mol-theme/color/molecule-type.js +8 -8
- package/lib/mol-theme/color/occupancy.js +1 -1
- package/lib/mol-theme/color/operator-hkl.js +1 -1
- package/lib/mol-theme/color/operator-name.js +1 -1
- package/lib/mol-theme/color/partial-charge.js +1 -1
- package/lib/mol-theme/color/polymer-id.js +4 -4
- package/lib/mol-theme/color/polymer-index.js +1 -1
- package/lib/mol-theme/color/residue-name.js +1 -1
- package/lib/mol-theme/color/secondary-structure.js +12 -12
- package/lib/mol-theme/color/sequence-id.js +7 -7
- package/lib/mol-theme/color/shape-group.js +1 -1
- package/lib/mol-theme/color/uncertainty.js +1 -1
- package/lib/mol-theme/color/uniform.js +1 -1
- package/lib/mol-theme/color/unit-index.js +1 -1
- package/lib/mol-theme/color/volume-value.js +1 -1
- package/lib/mol-theme/label.js +3 -3
- package/lib/mol-util/binding.js +4 -4
- package/lib/mol-util/debug.d.ts +6 -1
- package/lib/mol-util/debug.js +9 -1
- package/lib/mol-util/input/input-observer.js +20 -20
- package/lib/mol-util/string-builder.js +1 -1
- package/lib/servers/model/preprocess/converter.js +1 -1
- package/lib/servers/model/server/query.js +1 -1
- package/lib/servers/model/utils/fetch-retry.js +3 -2
- package/lib/servers/volume/server/algebra/coordinate.js +6 -6
- package/lib/servers/volume/server/query/encode.js +1 -1
- package/package.json +8 -8
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Copyright (c) 2018-
|
|
3
|
+
* Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
4
4
|
*
|
|
5
5
|
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
|
6
6
|
*/
|
|
@@ -198,6 +198,18 @@ function getDefinesCode(defines, ignore) {
|
|
|
198
198
|
}
|
|
199
199
|
return lines.join('\n') + '\n';
|
|
200
200
|
}
|
|
201
|
+
function getGlsl100VertPrefix(extensions, shaderExtensions) {
|
|
202
|
+
var prefix = [];
|
|
203
|
+
if (shaderExtensions.drawBuffers) {
|
|
204
|
+
if (extensions.drawBuffers) {
|
|
205
|
+
prefix.push('#define requiredDrawBuffers');
|
|
206
|
+
}
|
|
207
|
+
else if (shaderExtensions.drawBuffers === 'required') {
|
|
208
|
+
throw new Error("required 'GL_EXT_draw_buffers' extension not available");
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return prefix.join('\n') + '\n';
|
|
212
|
+
}
|
|
201
213
|
function getGlsl100FragPrefix(extensions, shaderExtensions) {
|
|
202
214
|
var prefix = [
|
|
203
215
|
'#extension GL_OES_standard_derivatives : enable'
|
|
@@ -235,25 +247,43 @@ function getGlsl100FragPrefix(extensions, shaderExtensions) {
|
|
|
235
247
|
}
|
|
236
248
|
return prefix.join('\n') + '\n';
|
|
237
249
|
}
|
|
238
|
-
var
|
|
250
|
+
var glsl300VertPrefixCommon = "\n#define attribute in\n#define varying out\n#define texture2D texture\n";
|
|
239
251
|
var glsl300FragPrefixCommon = "\n#define varying in\n#define texture2D texture\n#define texture2DLodEXT textureLod\n\n#define gl_FragColor out_FragData0\n#define gl_FragDepthEXT gl_FragDepth\n\n#define depthTextureSupport\n";
|
|
252
|
+
function getGlsl300VertPrefix(extensions, shaderExtensions) {
|
|
253
|
+
var prefix = [
|
|
254
|
+
'#version 300 es',
|
|
255
|
+
];
|
|
256
|
+
if (shaderExtensions.drawBuffers) {
|
|
257
|
+
if (extensions.drawBuffers) {
|
|
258
|
+
prefix.push('#define requiredDrawBuffers');
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
prefix.push(glsl300VertPrefixCommon);
|
|
262
|
+
return prefix.join('\n') + '\n';
|
|
263
|
+
}
|
|
240
264
|
function getGlsl300FragPrefix(gl, extensions, shaderExtensions, outTypes) {
|
|
241
265
|
var prefix = [
|
|
242
266
|
'#version 300 es',
|
|
243
267
|
"layout(location = 0) out highp ".concat(outTypes[0] || 'vec4', " out_FragData0;")
|
|
244
268
|
];
|
|
245
269
|
if (shaderExtensions.fragDepth) {
|
|
246
|
-
|
|
270
|
+
if (extensions.fragDepth) {
|
|
271
|
+
prefix.push('#define enabledFragDepth');
|
|
272
|
+
}
|
|
247
273
|
}
|
|
248
274
|
if (shaderExtensions.drawBuffers) {
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
275
|
+
if (extensions.drawBuffers) {
|
|
276
|
+
prefix.push('#define requiredDrawBuffers');
|
|
277
|
+
var maxDrawBuffers = gl.getParameter(gl.MAX_DRAW_BUFFERS);
|
|
278
|
+
for (var i = 1, il = maxDrawBuffers; i < il; ++i) {
|
|
279
|
+
prefix.push("layout(location = ".concat(i, ") out highp ").concat(outTypes[i] || 'vec4', " out_FragData").concat(i, ";"));
|
|
280
|
+
}
|
|
253
281
|
}
|
|
254
282
|
}
|
|
255
283
|
if (shaderExtensions.shaderTextureLod) {
|
|
256
|
-
|
|
284
|
+
if (extensions.shaderTextureLod) {
|
|
285
|
+
prefix.push('#define enabledShaderTextureLod');
|
|
286
|
+
}
|
|
257
287
|
}
|
|
258
288
|
prefix.push(glsl300FragPrefixCommon);
|
|
259
289
|
return prefix.join('\n') + '\n';
|
|
@@ -264,7 +294,9 @@ function transformGlsl300Frag(frag) {
|
|
|
264
294
|
function addShaderDefines(gl, extensions, defines, shaders) {
|
|
265
295
|
var vertHeader = getDefinesCode(defines, shaders.ignoreDefine);
|
|
266
296
|
var fragHeader = getDefinesCode(defines, shaders.ignoreDefine);
|
|
267
|
-
var vertPrefix = (0, compat_1.isWebGL2)(gl)
|
|
297
|
+
var vertPrefix = (0, compat_1.isWebGL2)(gl)
|
|
298
|
+
? getGlsl300VertPrefix(extensions, shaders.extensions)
|
|
299
|
+
: getGlsl100VertPrefix(extensions, shaders.extensions);
|
|
268
300
|
var fragPrefix = (0, compat_1.isWebGL2)(gl)
|
|
269
301
|
? getGlsl300FragPrefix(gl, extensions, shaders.extensions, shaders.outTypes)
|
|
270
302
|
: getGlsl100FragPrefix(extensions, shaders.extensions);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c) 2018-
|
|
2
|
+
* Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
3
3
|
*
|
|
4
4
|
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
|
5
5
|
*/
|
|
@@ -93,4 +93,37 @@ export interface COMPAT_sRGB {
|
|
|
93
93
|
readonly SRGB: number;
|
|
94
94
|
}
|
|
95
95
|
export declare function getSRGB(gl: GLRenderingContext): COMPAT_sRGB | null;
|
|
96
|
+
export interface COMPAT_disjoint_timer_query {
|
|
97
|
+
/** A GLint indicating the number of bits used to hold the query result for the given target. */
|
|
98
|
+
QUERY_COUNTER_BITS: number;
|
|
99
|
+
/** A WebGLQuery object, which is the currently active query for the given target. */
|
|
100
|
+
CURRENT_QUERY: number;
|
|
101
|
+
/** A GLuint64EXT containing the query result. */
|
|
102
|
+
QUERY_RESULT: number;
|
|
103
|
+
/** A GLboolean indicating whether or not a query result is available. */
|
|
104
|
+
QUERY_RESULT_AVAILABLE: number;
|
|
105
|
+
/** Elapsed time (in nanoseconds). */
|
|
106
|
+
TIME_ELAPSED: number;
|
|
107
|
+
/** The current time. */
|
|
108
|
+
TIMESTAMP: number;
|
|
109
|
+
/** A GLboolean indicating whether or not the GPU performed any disjoint operation. */
|
|
110
|
+
GPU_DISJOINT: number;
|
|
111
|
+
/** Creates a new WebGLTimerQueryEXT. */
|
|
112
|
+
createQuery: () => WebGLQuery;
|
|
113
|
+
/** Deletes a given WebGLTimerQueryEXT. */
|
|
114
|
+
deleteQuery: (query: WebGLQuery) => void;
|
|
115
|
+
/** Returns true if a given object is a valid WebGLTimerQueryEXT. */
|
|
116
|
+
isQuery: (query: WebGLQuery) => boolean;
|
|
117
|
+
/** The timer starts when all commands prior to beginQueryEXT have been fully executed. */
|
|
118
|
+
beginQuery: (target: number, query: WebGLQuery) => void;
|
|
119
|
+
/** The timer stops when all commands prior to endQueryEXT have been fully executed. */
|
|
120
|
+
endQuery: (target: number) => void;
|
|
121
|
+
/** Records the current time into the corresponding query object. */
|
|
122
|
+
queryCounter: (query: WebGLQuery, target: number) => void;
|
|
123
|
+
/** Returns information about a query target. */
|
|
124
|
+
getQuery: (target: number, pname: number) => WebGLQuery | number;
|
|
125
|
+
/** Return the state of a query object. */
|
|
126
|
+
getQueryParameter: (query: WebGLQuery, pname: number) => number | boolean;
|
|
127
|
+
}
|
|
128
|
+
export declare function getDisjointTimerQuery(gl: GLRenderingContext): COMPAT_disjoint_timer_query | null;
|
|
96
129
|
export declare function testColorBuffer(gl: GLRenderingContext, type: number): boolean;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Copyright (c) 2018-
|
|
3
|
+
* Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
4
4
|
*
|
|
5
5
|
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.testColorBuffer = exports.getSRGB = exports.getDepthTexture = exports.getShaderTextureLod = exports.getDrawBuffers = exports.getColorBufferHalfFloat = exports.getColorBufferFloat = exports.getFragDepth = exports.getBlendMinMax = exports.getTextureHalfFloatLinear = exports.getTextureHalfFloat = exports.getTextureFloatLinear = exports.getTextureFloat = exports.getVertexArrayObject = exports.getElementIndexUint = exports.getStandardDerivatives = exports.getInstancedArrays = exports.isWebGL2 = exports.isWebGL = void 0;
|
|
8
|
+
exports.testColorBuffer = exports.getDisjointTimerQuery = exports.getSRGB = exports.getDepthTexture = exports.getShaderTextureLod = exports.getDrawBuffers = exports.getColorBufferHalfFloat = exports.getColorBufferFloat = exports.getFragDepth = exports.getBlendMinMax = exports.getTextureHalfFloatLinear = exports.getTextureHalfFloat = exports.getTextureFloatLinear = exports.getTextureFloat = exports.getVertexArrayObject = exports.getElementIndexUint = exports.getStandardDerivatives = exports.getInstancedArrays = exports.isWebGL2 = exports.isWebGL = void 0;
|
|
9
9
|
var debug_1 = require("../../mol-util/debug");
|
|
10
10
|
var context_1 = require("./context");
|
|
11
11
|
var program_1 = require("./program");
|
|
@@ -252,6 +252,54 @@ function getSRGB(gl) {
|
|
|
252
252
|
}
|
|
253
253
|
}
|
|
254
254
|
exports.getSRGB = getSRGB;
|
|
255
|
+
function getDisjointTimerQuery(gl) {
|
|
256
|
+
if (isWebGL2(gl)) {
|
|
257
|
+
// Firefox has EXT_disjoint_timer_query in webgl2
|
|
258
|
+
var ext = gl.getExtension('EXT_disjoint_timer_query_webgl2') || gl.getExtension('EXT_disjoint_timer_query');
|
|
259
|
+
if (ext === null)
|
|
260
|
+
return null;
|
|
261
|
+
return {
|
|
262
|
+
QUERY_COUNTER_BITS: ext.QUERY_COUNTER_BITS_EXT,
|
|
263
|
+
CURRENT_QUERY: gl.CURRENT_QUERY,
|
|
264
|
+
QUERY_RESULT: gl.QUERY_RESULT,
|
|
265
|
+
QUERY_RESULT_AVAILABLE: gl.QUERY_RESULT_AVAILABLE,
|
|
266
|
+
TIME_ELAPSED: ext.TIME_ELAPSED_EXT,
|
|
267
|
+
TIMESTAMP: ext.TIMESTAMP_EXT,
|
|
268
|
+
GPU_DISJOINT: ext.GPU_DISJOINT_EXT,
|
|
269
|
+
createQuery: gl.createQuery.bind(gl),
|
|
270
|
+
deleteQuery: gl.deleteQuery.bind(gl),
|
|
271
|
+
isQuery: gl.isQuery.bind(gl),
|
|
272
|
+
beginQuery: gl.beginQuery.bind(gl),
|
|
273
|
+
endQuery: gl.endQuery.bind(gl),
|
|
274
|
+
queryCounter: ext.queryCounterEXT.bind(ext),
|
|
275
|
+
getQuery: gl.getQuery.bind(gl),
|
|
276
|
+
getQueryParameter: gl.getQueryParameter.bind(gl),
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
else {
|
|
280
|
+
var ext = gl.getExtension('EXT_disjoint_timer_query');
|
|
281
|
+
if (ext === null)
|
|
282
|
+
return null;
|
|
283
|
+
return {
|
|
284
|
+
QUERY_COUNTER_BITS: ext.QUERY_COUNTER_BITS_EXT,
|
|
285
|
+
CURRENT_QUERY: ext.CURRENT_QUERY_EXT,
|
|
286
|
+
QUERY_RESULT: ext.QUERY_RESULT_EXT,
|
|
287
|
+
QUERY_RESULT_AVAILABLE: ext.QUERY_RESULT_AVAILABLE_EXT,
|
|
288
|
+
TIME_ELAPSED: ext.TIME_ELAPSED_EXT,
|
|
289
|
+
TIMESTAMP: ext.TIMESTAMP_EXT,
|
|
290
|
+
GPU_DISJOINT: ext.GPU_DISJOINT_EXT,
|
|
291
|
+
createQuery: ext.createQueryEXT.bind(ext),
|
|
292
|
+
deleteQuery: ext.deleteQueryEXT.bind(ext),
|
|
293
|
+
isQuery: ext.isQueryEXT.bind(ext),
|
|
294
|
+
beginQuery: ext.beginQueryEXT.bind(ext),
|
|
295
|
+
endQuery: ext.endQueryEXT.bind(ext),
|
|
296
|
+
queryCounter: ext.queryCounterEXT.bind(ext),
|
|
297
|
+
getQuery: ext.getQueryEXT.bind(ext),
|
|
298
|
+
getQueryParameter: ext.getQueryObjectEXT.bind(ext),
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
exports.getDisjointTimerQuery = getDisjointTimerQuery;
|
|
255
303
|
//
|
|
256
304
|
var TextureTestVertShader = "\nattribute vec4 aPosition;\n\nvoid main() {\n gl_Position = aPosition;\n}";
|
|
257
305
|
var TextureTestFragShader = "\nprecision mediump float;\nuniform vec4 uColor;\nuniform sampler2D uTexture;\n\nvoid main() {\n gl_FragColor = texture2D(uTexture, vec2(0.5, 0.5)) * uColor;\n}";
|
|
@@ -14,6 +14,7 @@ import { BehaviorSubject } from 'rxjs';
|
|
|
14
14
|
import { now } from '../../mol-util/now';
|
|
15
15
|
import { Texture, TextureFilter } from './texture';
|
|
16
16
|
import { ComputeRenderable } from '../renderable';
|
|
17
|
+
import { WebGLTimer } from './timer';
|
|
17
18
|
export declare function getGLContext(canvas: HTMLCanvasElement, attribs?: WebGLContextAttributes & {
|
|
18
19
|
preferWebGl1?: boolean;
|
|
19
20
|
}): GLRenderingContext | null;
|
|
@@ -45,6 +46,7 @@ export interface WebGLContext {
|
|
|
45
46
|
readonly state: WebGLState;
|
|
46
47
|
readonly stats: WebGLStats;
|
|
47
48
|
readonly resources: WebGLResources;
|
|
49
|
+
readonly timer: WebGLTimer;
|
|
48
50
|
readonly maxTextureSize: number;
|
|
49
51
|
readonly max3dTextureSize: number;
|
|
50
52
|
readonly maxRenderbufferSize: number;
|
|
@@ -18,6 +18,7 @@ var resources_1 = require("./resources");
|
|
|
18
18
|
var render_target_1 = require("./render-target");
|
|
19
19
|
var rxjs_1 = require("rxjs");
|
|
20
20
|
var now_1 = require("../../mol-util/now");
|
|
21
|
+
var timer_1 = require("./timer");
|
|
21
22
|
function getGLContext(canvas, attribs) {
|
|
22
23
|
function get(id) {
|
|
23
24
|
try {
|
|
@@ -176,6 +177,7 @@ function createContext(gl, props) {
|
|
|
176
177
|
var state = (0, state_1.createState)(gl);
|
|
177
178
|
var stats = createStats();
|
|
178
179
|
var resources = (0, resources_1.createResources)(gl, state, stats, extensions);
|
|
180
|
+
var timer = (0, timer_1.createTimer)(gl, extensions);
|
|
179
181
|
var parameters = {
|
|
180
182
|
maxTextureSize: gl.getParameter(gl.MAX_TEXTURE_SIZE),
|
|
181
183
|
max3dTextureSize: (0, compat_1.isWebGL2)(gl) ? gl.getParameter(gl.MAX_3D_TEXTURE_SIZE) : 0,
|
|
@@ -240,6 +242,7 @@ function createContext(gl, props) {
|
|
|
240
242
|
state: state,
|
|
241
243
|
stats: stats,
|
|
242
244
|
resources: resources,
|
|
245
|
+
timer: timer,
|
|
243
246
|
get maxTextureSize() { return parameters.maxTextureSize; },
|
|
244
247
|
get max3dTextureSize() { return parameters.max3dTextureSize; },
|
|
245
248
|
get maxRenderbufferSize() { return parameters.maxRenderbufferSize; },
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c) 2018-
|
|
2
|
+
* Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
3
3
|
*
|
|
4
4
|
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
|
5
5
|
*/
|
|
6
|
-
import { GLRenderingContext, COMPAT_instanced_arrays, COMPAT_standard_derivatives, COMPAT_vertex_array_object, COMPAT_element_index_uint, COMPAT_texture_float, COMPAT_texture_float_linear, COMPAT_blend_minmax, COMPAT_frag_depth, COMPAT_color_buffer_float, COMPAT_draw_buffers, COMPAT_shader_texture_lod, COMPAT_depth_texture, COMPAT_sRGB, COMPAT_texture_half_float, COMPAT_texture_half_float_linear, COMPAT_color_buffer_half_float } from './compat';
|
|
6
|
+
import { GLRenderingContext, COMPAT_instanced_arrays, COMPAT_standard_derivatives, COMPAT_vertex_array_object, COMPAT_element_index_uint, COMPAT_texture_float, COMPAT_texture_float_linear, COMPAT_blend_minmax, COMPAT_frag_depth, COMPAT_color_buffer_float, COMPAT_draw_buffers, COMPAT_shader_texture_lod, COMPAT_depth_texture, COMPAT_sRGB, COMPAT_texture_half_float, COMPAT_texture_half_float_linear, COMPAT_color_buffer_half_float, COMPAT_disjoint_timer_query } from './compat';
|
|
7
7
|
export declare type WebGLExtensions = {
|
|
8
8
|
instancedArrays: COMPAT_instanced_arrays;
|
|
9
9
|
elementIndexUint: COMPAT_element_index_uint;
|
|
@@ -21,5 +21,6 @@ export declare type WebGLExtensions = {
|
|
|
21
21
|
drawBuffers: COMPAT_draw_buffers | null;
|
|
22
22
|
shaderTextureLod: COMPAT_shader_texture_lod | null;
|
|
23
23
|
sRGB: COMPAT_sRGB | null;
|
|
24
|
+
disjointTimerQuery: COMPAT_disjoint_timer_query | null;
|
|
24
25
|
};
|
|
25
26
|
export declare function createExtensions(gl: GLRenderingContext): WebGLExtensions;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Copyright (c) 2018-
|
|
3
|
+
* Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
4
4
|
*
|
|
5
5
|
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
|
6
6
|
*/
|
|
@@ -79,6 +79,10 @@ function createExtensions(gl) {
|
|
|
79
79
|
if (debug_1.isDebugMode && sRGB === null) {
|
|
80
80
|
console.log('Could not find support for "sRGB"');
|
|
81
81
|
}
|
|
82
|
+
var disjointTimerQuery = (0, compat_1.getDisjointTimerQuery)(gl);
|
|
83
|
+
if (debug_1.isDebugMode && disjointTimerQuery === null) {
|
|
84
|
+
console.log('Could not find support for "disjoint_timer_query"');
|
|
85
|
+
}
|
|
82
86
|
return {
|
|
83
87
|
instancedArrays: instancedArrays,
|
|
84
88
|
standardDerivatives: standardDerivatives,
|
|
@@ -96,6 +100,7 @@ function createExtensions(gl) {
|
|
|
96
100
|
drawBuffers: drawBuffers,
|
|
97
101
|
shaderTextureLod: shaderTextureLod,
|
|
98
102
|
sRGB: sRGB,
|
|
103
|
+
disjointTimerQuery: disjointTimerQuery,
|
|
99
104
|
};
|
|
100
105
|
}
|
|
101
106
|
exports.createExtensions = createExtensions;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
3
|
+
*
|
|
4
|
+
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
|
5
|
+
*/
|
|
6
|
+
import { GLRenderingContext } from './compat';
|
|
7
|
+
import { WebGLExtensions } from './extensions';
|
|
8
|
+
export declare type TimerResult = {
|
|
9
|
+
readonly label: string;
|
|
10
|
+
readonly timeElapsed: number;
|
|
11
|
+
readonly children: TimerResult[];
|
|
12
|
+
};
|
|
13
|
+
export declare type WebGLTimer = {
|
|
14
|
+
/** Check with GPU for finished timers. */
|
|
15
|
+
resolve: () => TimerResult[];
|
|
16
|
+
mark: (label: string) => void;
|
|
17
|
+
markEnd: (label: string) => void;
|
|
18
|
+
clear: () => void;
|
|
19
|
+
destroy: () => void;
|
|
20
|
+
};
|
|
21
|
+
export declare function createTimer(gl: GLRenderingContext, extensions: WebGLExtensions): WebGLTimer;
|
|
22
|
+
export declare function printTimerResults(results: TimerResult[]): void[];
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
4
|
+
*
|
|
5
|
+
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.printTimerResults = exports.createTimer = void 0;
|
|
9
|
+
function getQuery(extensions) {
|
|
10
|
+
return extensions.disjointTimerQuery ? extensions.disjointTimerQuery.createQuery() : null;
|
|
11
|
+
}
|
|
12
|
+
function createTimer(gl, extensions) {
|
|
13
|
+
var dtq = extensions.disjointTimerQuery;
|
|
14
|
+
var queries = new Map();
|
|
15
|
+
var pending = new Map();
|
|
16
|
+
var stack = [];
|
|
17
|
+
var measures = [];
|
|
18
|
+
var current = null;
|
|
19
|
+
var clear = function () {
|
|
20
|
+
if (!dtq)
|
|
21
|
+
return;
|
|
22
|
+
queries.forEach(function (_, query) {
|
|
23
|
+
dtq.deleteQuery(query);
|
|
24
|
+
});
|
|
25
|
+
pending.clear();
|
|
26
|
+
measures = [];
|
|
27
|
+
current = null;
|
|
28
|
+
};
|
|
29
|
+
var add = function () {
|
|
30
|
+
if (!dtq)
|
|
31
|
+
return;
|
|
32
|
+
var query = getQuery(extensions);
|
|
33
|
+
if (!query)
|
|
34
|
+
return;
|
|
35
|
+
dtq.beginQuery(dtq.TIME_ELAPSED, query);
|
|
36
|
+
pending.forEach(function (measure, _) {
|
|
37
|
+
measure.queries.push(query);
|
|
38
|
+
});
|
|
39
|
+
queries.set(query, { refCount: pending.size });
|
|
40
|
+
current = query;
|
|
41
|
+
};
|
|
42
|
+
return {
|
|
43
|
+
resolve: function () {
|
|
44
|
+
var results = [];
|
|
45
|
+
if (!dtq || !measures.length)
|
|
46
|
+
return results;
|
|
47
|
+
// console.log('resolve');
|
|
48
|
+
queries.forEach(function (result, query) {
|
|
49
|
+
if (result.timeElapsed !== undefined)
|
|
50
|
+
return;
|
|
51
|
+
var available = dtq.getQueryParameter(query, dtq.QUERY_RESULT_AVAILABLE);
|
|
52
|
+
var disjoint = gl.getParameter(dtq.GPU_DISJOINT);
|
|
53
|
+
if (available && !disjoint) {
|
|
54
|
+
var timeElapsed = dtq.getQueryParameter(query, dtq.QUERY_RESULT);
|
|
55
|
+
result.timeElapsed = timeElapsed;
|
|
56
|
+
// console.log('timeElapsed', result.timeElapsed);
|
|
57
|
+
}
|
|
58
|
+
if (available || disjoint) {
|
|
59
|
+
dtq.deleteQuery(query);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
var unresolved = [];
|
|
63
|
+
var _loop_1 = function (measure) {
|
|
64
|
+
if (measure.queries.every(function (q) { var _a; return ((_a = queries.get(q)) === null || _a === void 0 ? void 0 : _a.timeElapsed) !== undefined; })) {
|
|
65
|
+
var timeElapsed = 0;
|
|
66
|
+
for (var _a = 0, _b = measure.queries; _a < _b.length; _a++) {
|
|
67
|
+
var query = _b[_a];
|
|
68
|
+
var result = queries.get(query);
|
|
69
|
+
timeElapsed += result.timeElapsed;
|
|
70
|
+
result.refCount -= 1;
|
|
71
|
+
}
|
|
72
|
+
measure.timeElapsed = timeElapsed;
|
|
73
|
+
if (measure.root) {
|
|
74
|
+
var children = [];
|
|
75
|
+
var add_1 = function (measures, children) {
|
|
76
|
+
for (var _i = 0, measures_2 = measures; _i < measures_2.length; _i++) {
|
|
77
|
+
var measure_1 = measures_2[_i];
|
|
78
|
+
var result = {
|
|
79
|
+
label: measure_1.label,
|
|
80
|
+
timeElapsed: measure_1.timeElapsed,
|
|
81
|
+
children: []
|
|
82
|
+
};
|
|
83
|
+
children.push(result);
|
|
84
|
+
add_1(measure_1.children, result.children);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
add_1(measure.children, children);
|
|
88
|
+
results.push({ label: measure.label, timeElapsed: timeElapsed, children: children });
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
unresolved.push(measure);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
for (var _i = 0, measures_1 = measures; _i < measures_1.length; _i++) {
|
|
96
|
+
var measure = measures_1[_i];
|
|
97
|
+
_loop_1(measure);
|
|
98
|
+
}
|
|
99
|
+
measures = unresolved;
|
|
100
|
+
queries.forEach(function (result, query) {
|
|
101
|
+
if (result.refCount === 0) {
|
|
102
|
+
queries.delete(query);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
return results;
|
|
106
|
+
},
|
|
107
|
+
mark: function (label) {
|
|
108
|
+
if (!dtq)
|
|
109
|
+
return;
|
|
110
|
+
if (pending.has(label)) {
|
|
111
|
+
throw new Error("Timer mark for '".concat(label, "' already exists"));
|
|
112
|
+
}
|
|
113
|
+
if (current !== null) {
|
|
114
|
+
dtq.endQuery(dtq.TIME_ELAPSED);
|
|
115
|
+
}
|
|
116
|
+
var measure = { label: label, queries: [], children: [], root: current === null };
|
|
117
|
+
pending.set(label, measure);
|
|
118
|
+
if (stack.length) {
|
|
119
|
+
stack[stack.length - 1].children.push(measure);
|
|
120
|
+
}
|
|
121
|
+
stack.push(measure);
|
|
122
|
+
add();
|
|
123
|
+
},
|
|
124
|
+
markEnd: function (label) {
|
|
125
|
+
var _a;
|
|
126
|
+
if (!dtq)
|
|
127
|
+
return;
|
|
128
|
+
var measure = pending.get(label);
|
|
129
|
+
if (!measure) {
|
|
130
|
+
throw new Error("Timer mark for '".concat(label, "' does not exist"));
|
|
131
|
+
}
|
|
132
|
+
if (((_a = stack.pop()) === null || _a === void 0 ? void 0 : _a.label) !== label) {
|
|
133
|
+
throw new Error("Timer mark for '".concat(label, "' has pending nested mark"));
|
|
134
|
+
}
|
|
135
|
+
dtq.endQuery(dtq.TIME_ELAPSED);
|
|
136
|
+
pending.delete(label);
|
|
137
|
+
measures.push(measure);
|
|
138
|
+
if (pending.size > 0) {
|
|
139
|
+
add();
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
current = null;
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
clear: clear,
|
|
146
|
+
destroy: function () {
|
|
147
|
+
clear();
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
exports.createTimer = createTimer;
|
|
152
|
+
function formatTimerResult(result) {
|
|
153
|
+
var timeElapsed = result.timeElapsed / 1000 / 1000;
|
|
154
|
+
return "".concat(result.label, " ").concat(timeElapsed.toFixed(2), "ms");
|
|
155
|
+
}
|
|
156
|
+
function printTimerResults(results) {
|
|
157
|
+
return results.map(function (r) {
|
|
158
|
+
var f = formatTimerResult(r);
|
|
159
|
+
if (r.children.length) {
|
|
160
|
+
console.groupCollapsed(f);
|
|
161
|
+
printTimerResults(r.children);
|
|
162
|
+
console.groupEnd();
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
console.log(f);
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
exports.printTimerResults = printTimerResults;
|
|
@@ -78,37 +78,37 @@ var ArrayEncoding;
|
|
|
78
78
|
ArrayEncoding.by = by;
|
|
79
79
|
function uint8(data) {
|
|
80
80
|
return {
|
|
81
|
-
encodings: [{ kind: 'ByteArray', type: 4 /* Uint8 */ }],
|
|
81
|
+
encodings: [{ kind: 'ByteArray', type: 4 /* Encoding.IntDataType.Uint8 */ }],
|
|
82
82
|
data: data
|
|
83
83
|
};
|
|
84
84
|
}
|
|
85
85
|
function int8(data) {
|
|
86
86
|
return {
|
|
87
|
-
encodings: [{ kind: 'ByteArray', type: 1 /* Int8 */ }],
|
|
87
|
+
encodings: [{ kind: 'ByteArray', type: 1 /* Encoding.IntDataType.Int8 */ }],
|
|
88
88
|
data: new Uint8Array(data.buffer, data.byteOffset)
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
91
|
var writers = (_a = {},
|
|
92
|
-
_a[2 /* Int16 */] = function (v, i, a) { v.setInt16(2 * i, a, true); },
|
|
93
|
-
_a[5 /* Uint16 */] = function (v, i, a) { v.setUint16(2 * i, a, true); },
|
|
94
|
-
_a[3 /* Int32 */] = function (v, i, a) { v.setInt32(4 * i, a, true); },
|
|
95
|
-
_a[6 /* Uint32 */] = function (v, i, a) { v.setUint32(4 * i, a, true); },
|
|
96
|
-
_a[32 /* Float32 */] = function (v, i, a) { v.setFloat32(4 * i, a, true); },
|
|
97
|
-
_a[33 /* Float64 */] = function (v, i, a) { v.setFloat64(8 * i, a, true); },
|
|
92
|
+
_a[2 /* Encoding.IntDataType.Int16 */] = function (v, i, a) { v.setInt16(2 * i, a, true); },
|
|
93
|
+
_a[5 /* Encoding.IntDataType.Uint16 */] = function (v, i, a) { v.setUint16(2 * i, a, true); },
|
|
94
|
+
_a[3 /* Encoding.IntDataType.Int32 */] = function (v, i, a) { v.setInt32(4 * i, a, true); },
|
|
95
|
+
_a[6 /* Encoding.IntDataType.Uint32 */] = function (v, i, a) { v.setUint32(4 * i, a, true); },
|
|
96
|
+
_a[32 /* Encoding.FloatDataType.Float32 */] = function (v, i, a) { v.setFloat32(4 * i, a, true); },
|
|
97
|
+
_a[33 /* Encoding.FloatDataType.Float64 */] = function (v, i, a) { v.setFloat64(8 * i, a, true); },
|
|
98
98
|
_a);
|
|
99
99
|
var byteSizes = (_b = {},
|
|
100
|
-
_b[2 /* Int16 */] = 2,
|
|
101
|
-
_b[5 /* Uint16 */] = 2,
|
|
102
|
-
_b[3 /* Int32 */] = 4,
|
|
103
|
-
_b[6 /* Uint32 */] = 4,
|
|
104
|
-
_b[32 /* Float32 */] = 4,
|
|
105
|
-
_b[33 /* Float64 */] = 8,
|
|
100
|
+
_b[2 /* Encoding.IntDataType.Int16 */] = 2,
|
|
101
|
+
_b[5 /* Encoding.IntDataType.Uint16 */] = 2,
|
|
102
|
+
_b[3 /* Encoding.IntDataType.Int32 */] = 4,
|
|
103
|
+
_b[6 /* Encoding.IntDataType.Uint32 */] = 4,
|
|
104
|
+
_b[32 /* Encoding.FloatDataType.Float32 */] = 4,
|
|
105
|
+
_b[33 /* Encoding.FloatDataType.Float64 */] = 8,
|
|
106
106
|
_b);
|
|
107
107
|
function byteArray(data) {
|
|
108
108
|
var type = encoding_1.Encoding.getDataType(data);
|
|
109
|
-
if (type === 1 /* Int8 */)
|
|
109
|
+
if (type === 1 /* Encoding.IntDataType.Int8 */)
|
|
110
110
|
return int8(data);
|
|
111
|
-
else if (type === 4 /* Uint8 */)
|
|
111
|
+
else if (type === 4 /* Encoding.IntDataType.Uint8 */)
|
|
112
112
|
return uint8(data);
|
|
113
113
|
var result = new Uint8Array(data.length * byteSizes[type]);
|
|
114
114
|
var w = writers[type];
|
|
@@ -173,7 +173,7 @@ var ArrayEncoding;
|
|
|
173
173
|
var srcType = encoding_1.Encoding.getDataType(data);
|
|
174
174
|
if (srcType === void 0) {
|
|
175
175
|
data = new Int32Array(data);
|
|
176
|
-
srcType = 3 /* Int32 */;
|
|
176
|
+
srcType = 3 /* Encoding.IntDataType.Int32 */;
|
|
177
177
|
}
|
|
178
178
|
if (!data.length) {
|
|
179
179
|
return {
|
|
@@ -217,7 +217,7 @@ var ArrayEncoding;
|
|
|
217
217
|
var srcType = encoding_1.Encoding.getDataType(data);
|
|
218
218
|
if (srcType === void 0) {
|
|
219
219
|
data = new Int32Array(data);
|
|
220
|
-
srcType = 3 /* Int32 */;
|
|
220
|
+
srcType = 3 /* Encoding.IntDataType.Int32 */;
|
|
221
221
|
}
|
|
222
222
|
if (!data.length) {
|
|
223
223
|
return {
|
|
@@ -25,14 +25,14 @@ function decodeStep(data, encoding) {
|
|
|
25
25
|
switch (encoding.kind) {
|
|
26
26
|
case 'ByteArray': {
|
|
27
27
|
switch (encoding.type) {
|
|
28
|
-
case 4 /* Uint8 */: return data;
|
|
29
|
-
case 1 /* Int8 */: return int8(data);
|
|
30
|
-
case 2 /* Int16 */: return int16(data);
|
|
31
|
-
case 5 /* Uint16 */: return uint16(data);
|
|
32
|
-
case 3 /* Int32 */: return int32(data);
|
|
33
|
-
case 6 /* Uint32 */: return uint32(data);
|
|
34
|
-
case 32 /* Float32 */: return float32(data);
|
|
35
|
-
case 33 /* Float64 */: return float64(data);
|
|
28
|
+
case 4 /* Encoding.IntDataType.Uint8 */: return data;
|
|
29
|
+
case 1 /* Encoding.IntDataType.Int8 */: return int8(data);
|
|
30
|
+
case 2 /* Encoding.IntDataType.Int16 */: return int16(data);
|
|
31
|
+
case 5 /* Encoding.IntDataType.Uint16 */: return uint16(data);
|
|
32
|
+
case 3 /* Encoding.IntDataType.Int32 */: return int32(data);
|
|
33
|
+
case 6 /* Encoding.IntDataType.Uint32 */: return uint32(data);
|
|
34
|
+
case 32 /* Encoding.FloatDataType.Float32 */: return float32(data);
|
|
35
|
+
case 33 /* Encoding.FloatDataType.Float64 */: return float64(data);
|
|
36
36
|
default: (0, type_helpers_1.assertUnreachable)(encoding.type);
|
|
37
37
|
}
|
|
38
38
|
}
|
|
@@ -46,19 +46,19 @@ function decodeStep(data, encoding) {
|
|
|
46
46
|
}
|
|
47
47
|
function getIntArray(type, size) {
|
|
48
48
|
switch (type) {
|
|
49
|
-
case 1 /* Int8 */: return new Int8Array(size);
|
|
50
|
-
case 2 /* Int16 */: return new Int16Array(size);
|
|
51
|
-
case 3 /* Int32 */: return new Int32Array(size);
|
|
52
|
-
case 4 /* Uint8 */: return new Uint8Array(size);
|
|
53
|
-
case 5 /* Uint16 */: return new Uint16Array(size);
|
|
54
|
-
case 6 /* Uint32 */: return new Uint32Array(size);
|
|
49
|
+
case 1 /* Encoding.IntDataType.Int8 */: return new Int8Array(size);
|
|
50
|
+
case 2 /* Encoding.IntDataType.Int16 */: return new Int16Array(size);
|
|
51
|
+
case 3 /* Encoding.IntDataType.Int32 */: return new Int32Array(size);
|
|
52
|
+
case 4 /* Encoding.IntDataType.Uint8 */: return new Uint8Array(size);
|
|
53
|
+
case 5 /* Encoding.IntDataType.Uint16 */: return new Uint16Array(size);
|
|
54
|
+
case 6 /* Encoding.IntDataType.Uint32 */: return new Uint32Array(size);
|
|
55
55
|
default: (0, type_helpers_1.assertUnreachable)(type);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
function getFloatArray(type, size) {
|
|
59
59
|
switch (type) {
|
|
60
|
-
case 32 /* Float32 */: return new Float32Array(size);
|
|
61
|
-
case 33 /* Float64 */: return new Float64Array(size);
|
|
60
|
+
case 32 /* Encoding.FloatDataType.Float32 */: return new Float32Array(size);
|
|
61
|
+
case 33 /* Encoding.FloatDataType.Float64 */: return new Float64Array(size);
|
|
62
62
|
default: (0, type_helpers_1.assertUnreachable)(type);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
@@ -13,23 +13,23 @@ var Encoding;
|
|
|
13
13
|
function getDataType(data) {
|
|
14
14
|
var srcType;
|
|
15
15
|
if (data instanceof Int8Array)
|
|
16
|
-
srcType = 1 /* Int8 */;
|
|
16
|
+
srcType = 1 /* Encoding.IntDataType.Int8 */;
|
|
17
17
|
else if (data instanceof Int16Array)
|
|
18
|
-
srcType = 2 /* Int16 */;
|
|
18
|
+
srcType = 2 /* Encoding.IntDataType.Int16 */;
|
|
19
19
|
else if (data instanceof Int32Array)
|
|
20
|
-
srcType = 3 /* Int32 */;
|
|
20
|
+
srcType = 3 /* Encoding.IntDataType.Int32 */;
|
|
21
21
|
else if (data instanceof Uint8Array)
|
|
22
|
-
srcType = 4 /* Uint8 */;
|
|
22
|
+
srcType = 4 /* Encoding.IntDataType.Uint8 */;
|
|
23
23
|
else if (data instanceof Uint16Array)
|
|
24
|
-
srcType = 5 /* Uint16 */;
|
|
24
|
+
srcType = 5 /* Encoding.IntDataType.Uint16 */;
|
|
25
25
|
else if (data instanceof Uint32Array)
|
|
26
|
-
srcType = 6 /* Uint32 */;
|
|
26
|
+
srcType = 6 /* Encoding.IntDataType.Uint32 */;
|
|
27
27
|
else if (data instanceof Float32Array)
|
|
28
|
-
srcType = 32 /* Float32 */;
|
|
28
|
+
srcType = 32 /* Encoding.FloatDataType.Float32 */;
|
|
29
29
|
else if (data instanceof Float64Array)
|
|
30
|
-
srcType = 33 /* Float64 */;
|
|
30
|
+
srcType = 33 /* Encoding.FloatDataType.Float64 */;
|
|
31
31
|
else
|
|
32
|
-
srcType = 3 /* Int32 */; // throw new Error('Unsupported integer data type.');
|
|
32
|
+
srcType = 3 /* Encoding.IntDataType.Int32 */; // throw new Error('Unsupported integer data type.');
|
|
33
33
|
return srcType;
|
|
34
34
|
}
|
|
35
35
|
Encoding.getDataType = getDataType;
|