mirror of
https://github.com/molstar/molstar.git
synced 2026-06-05 22:31:26 +08:00
Compare commits
122 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c5871e9025 | ||
|
|
f26911b358 | ||
|
|
3a595b80b5 | ||
|
|
45760ddd41 | ||
|
|
447d068bf1 | ||
|
|
7e1642a4a3 | ||
|
|
7781267e78 | ||
|
|
f824fdcfed | ||
|
|
79dd441967 | ||
|
|
9dcf9c0785 | ||
|
|
83569462c6 | ||
|
|
947e169c3a | ||
|
|
e6b36c52d1 | ||
|
|
7fed3b84fa | ||
|
|
cbc941f193 | ||
|
|
a7ef0fb85f | ||
|
|
d10c36eaf5 | ||
|
|
e4c3a66753 | ||
|
|
f58f2cdc90 | ||
|
|
8f2676e91e | ||
|
|
89d397898e | ||
|
|
2dc32be9ee | ||
|
|
769220bd82 | ||
|
|
c75aa5dd52 | ||
|
|
88f1cfd8c4 | ||
|
|
108279c1aa | ||
|
|
8150490aac | ||
|
|
9497aa6362 | ||
|
|
3769da48a1 | ||
|
|
3c21fcd53a | ||
|
|
102ef2795d | ||
|
|
0befa253c2 | ||
|
|
87189cee58 | ||
|
|
3284f13fc6 | ||
|
|
70d219b120 | ||
|
|
a5ed3a08ea | ||
|
|
3665e7e999 | ||
|
|
9b583b23ae | ||
|
|
d602415e98 | ||
|
|
2c49a423e2 | ||
|
|
8a266e70c8 | ||
|
|
0df3bcd65d | ||
|
|
f5ecf5648e | ||
|
|
821f82fc3f | ||
|
|
92305fe628 | ||
|
|
17fe57b8a5 | ||
|
|
47433a51d3 | ||
|
|
e090827ced | ||
|
|
856e6a8b74 | ||
|
|
a813b4d40e | ||
|
|
98afc27442 | ||
|
|
9d4f28a395 | ||
|
|
50266d9a56 | ||
|
|
602a532cf2 | ||
|
|
b23d610c94 | ||
|
|
119c43d527 | ||
|
|
124feeb790 | ||
|
|
2c0e7e84da | ||
|
|
0d1e105343 | ||
|
|
f040c89ab3 | ||
|
|
5e9d8298ef | ||
|
|
7766ca2793 | ||
|
|
fb2f22f120 | ||
|
|
146fed3504 | ||
|
|
0b7a6e3375 | ||
|
|
f1fbdeaca0 | ||
|
|
ee7e37f6bc | ||
|
|
861f665ab3 | ||
|
|
456de23ad4 | ||
|
|
6d3578c17e | ||
|
|
57da7267e2 | ||
|
|
578b764406 | ||
|
|
f65a38a085 | ||
|
|
d187757bbc | ||
|
|
df83b24cf4 | ||
|
|
8e31ce0f5b | ||
|
|
4f69eb7963 | ||
|
|
4b9009216b | ||
|
|
895076c837 | ||
|
|
6e398ee64a | ||
|
|
c2177272b5 | ||
|
|
4877de5839 | ||
|
|
3cb9d10126 | ||
|
|
23c53cd9fb | ||
|
|
3471743a63 | ||
|
|
1b0b1809ef | ||
|
|
0833cffead | ||
|
|
a0a8ae88b7 | ||
|
|
e415cbeca4 | ||
|
|
4c15c93381 | ||
|
|
bd19822112 | ||
|
|
b87beb4a6e | ||
|
|
62a58facb2 | ||
|
|
5fa8178df7 | ||
|
|
d6043e7d1f | ||
|
|
8e432dfbb4 | ||
|
|
324ab3744b | ||
|
|
33ee4d0418 | ||
|
|
cbb104ccba | ||
|
|
0bda5461ae | ||
|
|
4096a03de1 | ||
|
|
fbee5f83df | ||
|
|
84a1b19850 | ||
|
|
1df5bd6d03 | ||
|
|
8bd4221a85 | ||
|
|
4d97ccdfb3 | ||
|
|
ca5e57ddbf | ||
|
|
ed6511799b | ||
|
|
9b1223ec15 | ||
|
|
97210ee67a | ||
|
|
308d1003ad | ||
|
|
ce9e193958 | ||
|
|
2a83afa8c1 | ||
|
|
8891fa328b | ||
|
|
a23c06c456 | ||
|
|
34e87121e1 | ||
|
|
6e5c20f442 | ||
|
|
8ac3bec451 | ||
|
|
5128d0f405 | ||
|
|
6ae2121391 | ||
|
|
749e0c5a47 | ||
|
|
7b55ef85e1 |
4
.github/workflows/node.yml
vendored
4
.github/workflows/node.yml
vendored
@@ -9,12 +9,12 @@ jobs:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 17
|
||||
node-version: 16
|
||||
- run: npm ci
|
||||
- run: sudo apt-get install xvfb
|
||||
- name: Lint
|
||||
run: npm run lint
|
||||
- name: Test
|
||||
run: xvfb-run --auto-servernum npm run jest
|
||||
run: npm install --no-save "gl@^5.0.0" && xvfb-run --auto-servernum npm run jest
|
||||
- name: Build
|
||||
run: npm run build
|
||||
|
||||
63
CHANGELOG.md
63
CHANGELOG.md
@@ -6,6 +6,69 @@ Note that since we don't clearly distinguish between a public and private interf
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [v3.8.2] - 2022-05-22
|
||||
|
||||
- Fix ``Scene.opacityAverage`` not taking xray shaded into account
|
||||
|
||||
## [v3.8.1] - 2022-05-14
|
||||
|
||||
- Fix issues with marking camera/handle helper (#433)
|
||||
- Fix issues with array uniforms when running with headless-gl
|
||||
- Fix Polymer Chain Instance coloring
|
||||
- Improve performance of scene marker/opacity average calculation
|
||||
|
||||
## [v3.8.0] - 2022-04-30
|
||||
|
||||
- Add support for outlines around transparent objects
|
||||
- Improve per-group transparency when wboit is switched off
|
||||
- Improve ``ColorTheme`` typing with ``ColorType`` generic.
|
||||
- Defaults to ``ColorTypeLocation``
|
||||
- Set when using ``ColorTypeDirect`` or ``ColorTypeGrid``
|
||||
- Fix case handling of ``struct_conf`` mmCIF enumeration field (#425)
|
||||
- Fix ``allowTransparentBackfaces`` for per-group transparency
|
||||
- Fix ``FormatRegistry.isApplicable`` returning true for unregistered formats
|
||||
- Fix: handle building of ``GridLookup3D`` with zero cell size
|
||||
- Fix ``ignoreLight`` for direct-volume rendering with webgl1
|
||||
- Fix (non-black) outlines when using transparent background
|
||||
|
||||
## [v3.7.0] - 2022-04-13
|
||||
|
||||
- Fix ``xrayShaded`` for texture-mesh geometries
|
||||
- [Breaking] Change ``allowTransparentBackfaces`` to ``transparentBackfaces`` with options ``off``, ``on``, ``opaque``. This was only added in 3.6.0, so allowing a breaking change here.
|
||||
- ``off``: don't show (default)
|
||||
- ``on``: show with transparency
|
||||
- ``opaque``: show fully opaque
|
||||
- Add option to disable file drop overlay.
|
||||
|
||||
## [v3.6.2] - 2022-04-05
|
||||
|
||||
- ModelServer ligand queries: fixes for alternate locations, additional atoms & UNL ligand
|
||||
- React 18 friendly ``useBehavior`` hook.
|
||||
|
||||
## [v3.6.1] - 2022-04-03
|
||||
|
||||
- Fix React18 related UI regressions.
|
||||
|
||||
## [v3.6.0] - 2022-04-03
|
||||
|
||||
- Check that model and coordinates have same element count when creating a trajectory
|
||||
- Fix aromatic rings assignment: do not mix flags and planarity test
|
||||
- Improve bonds assignment of coarse grained models: check for IndexPairBonds and exhaustive StructConn
|
||||
- Fix unit mapping in bondedAtomicPairs MolScript query
|
||||
- Improve pdb parsing: handle non unique atom and chain names (fixes #156)
|
||||
- Fix volume streaming for entries with multiple contour lists
|
||||
- Add ``allowTransparentBackfaces`` parameter to support double-sided rendering of transparent geometries
|
||||
- Fix handling of case insensitive mmCIF enumeration fields (including entity.type)
|
||||
- Fix ``disable-wboit`` Viewer GET param
|
||||
- Add support for React 18.
|
||||
- Used by importing ``createPluginUI`` from ``mol-plugin-ui/react18``;
|
||||
- In Mol* 4.0, React 18 will become the default option.
|
||||
|
||||
## [v3.5.0] - 2022-03-25
|
||||
|
||||
- Fix issues with bounding-sphere & color-smoothing (mostly for small geometries)
|
||||
- Support BCIF => CIF conversion in ``cif2bcif`` CLI tool
|
||||
|
||||
## [v3.4.0] - 2022-03-13
|
||||
|
||||
- Fix handling of mmcif with empty ``label_*`` fields
|
||||
|
||||
@@ -141,7 +141,7 @@ and navigate to `build/viewer`
|
||||
|
||||
export NODE_PATH="lib"; node build/state-docs
|
||||
|
||||
**Convert any CIF to BinaryCIF**
|
||||
**Convert any CIF to BinaryCIF (or vice versa)**
|
||||
|
||||
node lib/commonjs/servers/model/preprocess -i file.cif -ob file.bcif
|
||||
|
||||
@@ -151,6 +151,11 @@ Or
|
||||
|
||||
node lib/commonjs/cli/cif2bcif
|
||||
|
||||
E.g.
|
||||
|
||||
node lib/commonjs/cli/cif2bcif src.cif out.bcif.gz
|
||||
node lib/commonjs/cli/cif2bcif src.bcif.gz out.cif
|
||||
|
||||
## Development
|
||||
|
||||
### Installation
|
||||
|
||||
44
docs/file-formats.md
Normal file
44
docs/file-formats.md
Normal file
@@ -0,0 +1,44 @@
|
||||
|
||||
Support file formats and their extensions.
|
||||
|
||||
## Structure
|
||||
|
||||
- MMCIF and CIFCORE (mmCIF and coreCIF schemas): cif, bcif, mmcif, mcif
|
||||
- GRO: gro
|
||||
- MOL: mol
|
||||
- MOL2: mol2
|
||||
- PDB/PDBQT: pdb, ent, pdbqt
|
||||
- SDF: sdf, sd
|
||||
- XYZ: xyz
|
||||
|
||||
|
||||
## Topology
|
||||
|
||||
Need to be loaded together with Coordinates.
|
||||
|
||||
- PRMTOP: prmtop, parm7
|
||||
- PSF: psf
|
||||
- TOP: top
|
||||
|
||||
## Coordinates
|
||||
|
||||
Need to be loaded together with a Structure or Topology.
|
||||
|
||||
- DCD: dcd
|
||||
- NCTRAJ: nc, nctraj
|
||||
- TRR: trr
|
||||
- XTC: xtc
|
||||
|
||||
|
||||
## Volume
|
||||
|
||||
- CCP4/MRC/MAP: ccp4, mrc, map
|
||||
- CUBE (may include a Structure): cub, cube
|
||||
- DSN6/BRIX: dsn6, brix
|
||||
- DX and DXBIN: dx, dxbin
|
||||
- DSCIF (DensityServer CIF schema): cif, bcif
|
||||
|
||||
|
||||
## Shape
|
||||
|
||||
- PLY
|
||||
@@ -13,6 +13,7 @@
|
||||
* DZ has C1 instead of N1 (e.g. 6I4N)
|
||||
* DP has N5 instead of C5 and C7 instead of N7 (e.g. 6I4N)
|
||||
* Beta & Gamma peptides (e.g. 1GAC, 6PQF)
|
||||
* Helices of D-amino acids (e.g. 7QDI)
|
||||
* Mixed (heterogeneous) all-atom/trace-only RNA model (1JGQ)
|
||||
* Polymers with residues with missing trace atoms (e.g. 2QFJ)
|
||||
* Modified RNA bases (1y26, 5L4O)
|
||||
|
||||
45072
package-lock.json
generated
45072
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
58
package.json
58
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "molstar",
|
||||
"version": "3.4.0",
|
||||
"version": "3.8.2",
|
||||
"description": "A comprehensive macromolecular library.",
|
||||
"homepage": "https://github.com/molstar/molstar#readme",
|
||||
"repository": {
|
||||
@@ -94,38 +94,42 @@
|
||||
"@graphql-codegen/add": "^3.1.1",
|
||||
"@graphql-codegen/cli": "^2.6.2",
|
||||
"@graphql-codegen/time": "^3.1.1",
|
||||
"@graphql-codegen/typescript": "^2.4.7",
|
||||
"@graphql-codegen/typescript": "^2.4.11",
|
||||
"@graphql-codegen/typescript-graphql-files-modules": "^2.1.1",
|
||||
"@graphql-codegen/typescript-graphql-request": "^4.4.2",
|
||||
"@graphql-codegen/typescript-operations": "^2.3.4",
|
||||
"@graphql-codegen/typescript-graphql-request": "^4.4.8",
|
||||
"@graphql-codegen/typescript-operations": "^2.4.0",
|
||||
"@types/cors": "^2.8.12",
|
||||
"@types/gl": "^4.1.0",
|
||||
"@types/jest": "^27.4.1",
|
||||
"@typescript-eslint/eslint-plugin": "^5.14.0",
|
||||
"@typescript-eslint/parser": "^5.14.0",
|
||||
"@types/jest": "^27.5.1",
|
||||
"@types/react": "^18.0.9",
|
||||
"@types/react-dom": "^18.0.4",
|
||||
"@typescript-eslint/eslint-plugin": "^5.25.0",
|
||||
"@typescript-eslint/parser": "^5.25.0",
|
||||
"benchmark": "^2.1.4",
|
||||
"concurrently": "^7.0.0",
|
||||
"concurrently": "^7.2.0",
|
||||
"cpx2": "^4.2.0",
|
||||
"crypto-browserify": "^3.12.0",
|
||||
"css-loader": "^6.7.1",
|
||||
"eslint": "^8.11.0",
|
||||
"eslint": "^8.16.0",
|
||||
"extra-watch-webpack-plugin": "^1.0.3",
|
||||
"file-loader": "^6.2.0",
|
||||
"fs-extra": "^10.0.1",
|
||||
"graphql": "^16.3.0",
|
||||
"fs-extra": "^10.1.0",
|
||||
"graphql": "^16.5.0",
|
||||
"http-server": "^14.1.0",
|
||||
"jest": "^27.5.1",
|
||||
"jest": "^28.1.0",
|
||||
"mini-css-extract-plugin": "^2.6.0",
|
||||
"path-browserify": "^1.0.1",
|
||||
"raw-loader": "^4.0.2",
|
||||
"sass": "^1.49.9",
|
||||
"sass-loader": "^12.6.0",
|
||||
"simple-git": "^3.3.0",
|
||||
"react": "^18.1.0",
|
||||
"react-dom": "^18.1.0",
|
||||
"sass": "^1.52.1",
|
||||
"sass-loader": "^13.0.0",
|
||||
"simple-git": "^3.7.1",
|
||||
"stream-browserify": "^3.0.0",
|
||||
"style-loader": "^3.3.1",
|
||||
"ts-jest": "^27.1.3",
|
||||
"typescript": "^4.6.2",
|
||||
"webpack": "^5.70.0",
|
||||
"ts-jest": "^28.0.2",
|
||||
"typescript": "^4.6.4",
|
||||
"webpack": "^5.72.1",
|
||||
"webpack-cli": "^4.9.2"
|
||||
},
|
||||
"dependencies": {
|
||||
@@ -133,28 +137,26 @@
|
||||
"@types/benchmark": "^2.1.1",
|
||||
"@types/compression": "1.7.2",
|
||||
"@types/express": "^4.17.13",
|
||||
"@types/node": "^16.11.26",
|
||||
"@types/node": "^16.11.36",
|
||||
"@types/node-fetch": "^2.6.1",
|
||||
"@types/react": "^17.0.40",
|
||||
"@types/react-dom": "^17.0.13",
|
||||
"@types/swagger-ui-dist": "3.30.1",
|
||||
"argparse": "^2.0.1",
|
||||
"body-parser": "^1.19.2",
|
||||
"body-parser": "^1.20.0",
|
||||
"compression": "^1.7.4",
|
||||
"cors": "^2.8.5",
|
||||
"express": "^4.17.3",
|
||||
"express": "^4.18.1",
|
||||
"h264-mp4-encoder": "^1.0.12",
|
||||
"immer": "^9.0.12",
|
||||
"immer": "^9.0.14",
|
||||
"immutable": "^4.0.0",
|
||||
"node-fetch": "^2.6.7",
|
||||
"rxjs": "^7.5.5",
|
||||
"swagger-ui-dist": "^4.6.2",
|
||||
"tslib": "^2.3.1",
|
||||
"swagger-ui-dist": "^4.11.1",
|
||||
"tslib": "^2.4.0",
|
||||
"util.promisify": "^1.1.1",
|
||||
"xhr2": "^0.2.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^17.0.2 || ^16.14.0",
|
||||
"react-dom": "^17.0.2 || ^16.14.0"
|
||||
"react": "^18.1.0 || ^17.0.2 || ^16.14.0",
|
||||
"react-dom": "^18.1.0 || ^17.0.2 || ^16.14.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
import { Structure } from '../../mol-model/structure';
|
||||
import { BuiltInTrajectoryFormat } from '../../mol-plugin-state/formats/trajectory';
|
||||
import { PluginStateObject as PSO, PluginStateTransform } from '../../mol-plugin-state/objects';
|
||||
import { createPluginUI } from '../../mol-plugin-ui';
|
||||
import { createPluginUI } from '../../mol-plugin-ui/react18';
|
||||
import { PluginUIContext } from '../../mol-plugin-ui/context';
|
||||
import { PluginLayoutControlsDisplay } from '../../mol-plugin/layout';
|
||||
import { DefaultPluginUISpec, PluginUISpec } from '../../mol-plugin-ui/spec';
|
||||
|
||||
@@ -32,7 +32,7 @@ import { createVolumeRepresentationParams } from '../../mol-plugin-state/helpers
|
||||
import { PluginStateObject } from '../../mol-plugin-state/objects';
|
||||
import { StateTransforms } from '../../mol-plugin-state/transforms';
|
||||
import { TrajectoryFromModelAndCoordinates } from '../../mol-plugin-state/transforms/model';
|
||||
import { createPluginUI } from '../../mol-plugin-ui';
|
||||
import { createPluginUI } from '../../mol-plugin-ui/react18';
|
||||
import { PluginUIContext } from '../../mol-plugin-ui/context';
|
||||
import { DefaultPluginUISpec, PluginUISpec } from '../../mol-plugin-ui/spec';
|
||||
import { PluginCommands } from '../../mol-plugin/commands';
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
pixelScale: parseFloat(pixelScale) || 1,
|
||||
pickScale: parseFloat(pickScale) || 0.25,
|
||||
pickPadding: isNaN(parseFloat(pickPadding)) ? 1 : parseFloat(pickPadding),
|
||||
enableWboit: disableWboit ? true : void 0, // use default value if disable-wboit is not set
|
||||
enableWboit: disableWboit ? false : void 0, // use default value if disable-wboit is not set
|
||||
preferWebgl1: preferWebgl1,
|
||||
}).then(viewer => {
|
||||
var snapshotId = getParam('snapshot-id', '[^&]+').trim();
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Copyright (c) 2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2020-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* @author Josh McMenemy <josh.mcmenemy@gmail.com>
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
*/
|
||||
|
||||
import * as argparse from 'argparse';
|
||||
@@ -31,11 +32,11 @@ function extractIonNames(ccd: DatabaseCollection<CCD_Schema>) {
|
||||
|
||||
function writeIonNamesFile(filePath: string, ionNames: string[]) {
|
||||
const output = `/**
|
||||
* Copyright (c) 2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2020-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* Code-generated ion names params file. Names extracted from CCD components.
|
||||
*
|
||||
* @author molstar/chem-comp-dict/create-table cli
|
||||
* @author molstar/chem-comp-dict/create-ions cli
|
||||
*/
|
||||
|
||||
export const IonNames = new Set(${JSON.stringify(ionNames).replace(/"/g, "'").replace(/,/g, ', ')});
|
||||
|
||||
@@ -71,7 +71,7 @@ function classify(name: string, field: CifField): CifWriter.Field {
|
||||
}
|
||||
|
||||
export function convert(path: string, asText = false, hints?: EncodingStrategyHint[], filter?: string) {
|
||||
return Task.create<Uint8Array>('BinaryCIF', async ctx => {
|
||||
return Task.create<Uint8Array>('Convert CIF', async ctx => {
|
||||
const encodingProvider: BinaryEncodingProvider = hints
|
||||
? CifWriter.createEncodingProviderFromJsonConfig(hints)
|
||||
: { get: (c, f) => void 0 };
|
||||
|
||||
@@ -18,7 +18,7 @@ async function process(srcPath: string, outPath: string, configPath?: string, fi
|
||||
const config = configPath ? JSON.parse(fs.readFileSync(configPath, 'utf8')) : void 0;
|
||||
const filter = filterPath ? fs.readFileSync(filterPath, 'utf8') : void 0;
|
||||
|
||||
const res = await convert(srcPath, false, config, filter);
|
||||
const res = await convert(srcPath, srcPath.toLowerCase().indexOf('.bcif') > 0, config, filter);
|
||||
await write(outPath, res);
|
||||
}
|
||||
|
||||
@@ -38,13 +38,13 @@ function run(args: Args) {
|
||||
|
||||
const parser = new argparse.ArgumentParser({
|
||||
add_help: true,
|
||||
description: 'Convert any CIF file to a BCIF file'
|
||||
description: 'Convert any BCIF file to a CIF file or vice versa'
|
||||
});
|
||||
parser.add_argument('src', {
|
||||
help: 'Source CIF path'
|
||||
help: 'Source file path'
|
||||
});
|
||||
parser.add_argument('out', {
|
||||
help: 'Output BCIF path'
|
||||
help: 'Output file path'
|
||||
});
|
||||
parser.add_argument('-c', '--config', {
|
||||
help: 'Optional encoding strategy/precision config path',
|
||||
|
||||
@@ -161,7 +161,7 @@ const MMCIF_DIC_URL = 'http://mmcif.wwpdb.org/dictionaries/ascii/mmcif_pdbx_v50.
|
||||
const IHM_DIC_PATH = `${DIC_DIR}/ihm-extension.dic`;
|
||||
const IHM_DIC_URL = 'https://raw.githubusercontent.com/ihmwg/IHM-dictionary/master/ihm-extension.dic';
|
||||
const MA_DIC_PATH = `${DIC_DIR}/ma-extension.dic`;
|
||||
const MA_DIC_URL = 'https://raw.githubusercontent.com/ihmwg/MA-dictionary/master/mmcif_ma.dic';
|
||||
const MA_DIC_URL = 'https://raw.githubusercontent.com/ihmwg/ModelCIF/master/dist/mmcif_ma.dic';
|
||||
|
||||
const CIF_CORE_DIC_PATH = `${DIC_DIR}/cif_core.dic`;
|
||||
const CIF_CORE_DIC_URL = 'https://raw.githubusercontent.com/COMCIFS/cif_core/master/cif_core.dic';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2017-2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2017-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
*/
|
||||
@@ -13,15 +13,17 @@ export function getFieldType(type: string, description: string, values?: string[
|
||||
switch (type) {
|
||||
// mmCIF
|
||||
case 'code':
|
||||
case 'ucode':
|
||||
case 'line':
|
||||
case 'uline':
|
||||
case 'text':
|
||||
case 'char':
|
||||
case 'uchar3':
|
||||
case 'uchar1':
|
||||
case 'boolean':
|
||||
return values && values.length ? EnumCol(values, 'str', description) : StrCol(description);
|
||||
case 'ucode':
|
||||
case 'uline':
|
||||
case 'uchar3':
|
||||
case 'uchar1':
|
||||
// only force lower-case for enums
|
||||
return values && values.length ? EnumCol(values.map(x => x.toLowerCase()), 'lstr', description) : StrCol(description);
|
||||
case 'aliasname':
|
||||
case 'name':
|
||||
case 'idname':
|
||||
@@ -49,6 +51,7 @@ export function getFieldType(type: string, description: string, values?: string[
|
||||
case 'operation_expression':
|
||||
case 'point_symmetry':
|
||||
case '4x3_matrix':
|
||||
case '3x4_matrix':
|
||||
case '3x4_matrices':
|
||||
case 'point_group':
|
||||
case 'point_group_helical':
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2017-2019 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2017-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
*/
|
||||
@@ -10,7 +10,7 @@ import { FieldPath } from '../../../mol-io/reader/cif/schema';
|
||||
|
||||
function header(name: string, info: string, moldataImportPath: string) {
|
||||
return `/**
|
||||
* Copyright (c) 2017-2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2017-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* Code-generated '${name}' schema file. ${info}
|
||||
*
|
||||
@@ -35,13 +35,17 @@ function getTypeShorthands(schema: Database, fields?: Filter) {
|
||||
const { columns } = schema.tables[table];
|
||||
Object.keys(columns).forEach(columnName => {
|
||||
if (fields && !fields[table][columnName]) return;
|
||||
types.add(schema.tables[table].columns[columnName].type);
|
||||
const col = schema.tables[table].columns[columnName];
|
||||
if (col.type === 'enum') types.add(col.subType);
|
||||
types.add(col.type);
|
||||
});
|
||||
});
|
||||
const shorthands: string[] = [];
|
||||
types.forEach(type => {
|
||||
switch (type) {
|
||||
case 'str': shorthands.push('const str = Schema.str;'); break;
|
||||
case 'ustr': shorthands.push('const ustr = Schema.ustr;'); break;
|
||||
case 'lstr': shorthands.push('const lstr = Schema.lstr;'); break;
|
||||
case 'int': shorthands.push('const int = Schema.int;'); break;
|
||||
case 'float': shorthands.push('const float = Schema.float;'); break;
|
||||
case 'coord': shorthands.push('const coord = Schema.coord;'); break;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2017-2019 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2017-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
*/
|
||||
@@ -29,8 +29,8 @@ export function FloatCol(description: string): FloatCol { return { type: 'float'
|
||||
export type CoordCol = { type: 'coord' } & BaseCol
|
||||
export function CoordCol(description: string): CoordCol { return { type: 'coord', description }; }
|
||||
|
||||
export type EnumCol = { type: 'enum', subType: 'int' | 'str', values: string[] } & BaseCol
|
||||
export function EnumCol(values: string[], subType: 'int' | 'str', description: string): EnumCol {
|
||||
export type EnumCol = { type: 'enum', subType: 'int' | 'str' | 'ustr' | 'lstr', values: string[] } & BaseCol
|
||||
export function EnumCol(values: string[], subType: 'int' | 'str' | 'ustr' | 'lstr', description: string): EnumCol {
|
||||
return { type: 'enum', description, values, subType };
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import { SphericalBasisOrder } from '../../extensions/alpha-orbitals/spherical-f
|
||||
import { BasisAndOrbitals, CreateOrbitalDensityVolume, CreateOrbitalRepresentation3D, CreateOrbitalVolume, StaticBasisAndOrbitals } from '../../extensions/alpha-orbitals/transforms';
|
||||
import { canComputeGrid3dOnGPU } from '../../mol-gl/compute/grid3d';
|
||||
import { PluginStateObject } from '../../mol-plugin-state/objects';
|
||||
import { createPluginUI } from '../../mol-plugin-ui';
|
||||
import { createPluginUI } from '../../mol-plugin-ui/react18';
|
||||
import { PluginUIContext } from '../../mol-plugin-ui/context';
|
||||
import { DefaultPluginUISpec } from '../../mol-plugin-ui/spec';
|
||||
import { PluginCommands } from '../../mol-plugin/commands';
|
||||
@@ -80,20 +80,24 @@ export class AlphaOrbitalsExample {
|
||||
|
||||
this.plugin.managers.interactivity.setProps({ granularity: 'element' });
|
||||
|
||||
if (!canComputeGrid3dOnGPU(this.plugin.canvas3d?.webgl)) {
|
||||
PluginCommands.Toast.Show(this.plugin, {
|
||||
title: 'Error',
|
||||
message: `Browser/device does not support required WebGL extension (OES_texture_float).`
|
||||
this.plugin.behaviors.canvas3d.initialized.subscribe(init => {
|
||||
if (!init) return;
|
||||
|
||||
if (!canComputeGrid3dOnGPU(this.plugin.canvas3d?.webgl)) {
|
||||
PluginCommands.Toast.Show(this.plugin, {
|
||||
title: 'Error',
|
||||
message: `Browser/device does not support required WebGL extension (OES_texture_float).`
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
this.load({
|
||||
moleculeSdf: DemoMoleculeSDF,
|
||||
...DemoOrbitals
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
this.load({
|
||||
moleculeSdf: DemoMoleculeSDF,
|
||||
...DemoOrbitals
|
||||
mountControls(this, document.getElementById('controls')!);
|
||||
});
|
||||
|
||||
mountControls(this, document.getElementById('controls')!);
|
||||
}
|
||||
|
||||
readonly params = new BehaviorSubject<ParamDefinition.For<Params>>({} as any);
|
||||
|
||||
@@ -9,7 +9,7 @@ import { EmptyLoci } from '../../mol-model/loci';
|
||||
import { StructureSelection } from '../../mol-model/structure';
|
||||
import { AnimateModelIndex } from '../../mol-plugin-state/animation/built-in/model-index';
|
||||
import { BuiltInTrajectoryFormat } from '../../mol-plugin-state/formats/trajectory';
|
||||
import { createPluginUI } from '../../mol-plugin-ui';
|
||||
import { createPluginUI } from '../../mol-plugin-ui/react18';
|
||||
import { PluginUIContext } from '../../mol-plugin-ui/context';
|
||||
import { DefaultPluginUISpec } from '../../mol-plugin-ui/spec';
|
||||
import { PluginCommands } from '../../mol-plugin/commands';
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
import { Canvas3DProps } from '../../mol-canvas3d/canvas3d';
|
||||
import { BuiltInTrajectoryFormat } from '../../mol-plugin-state/formats/trajectory';
|
||||
import { createPluginUI } from '../../mol-plugin-ui';
|
||||
import { createPluginUI } from '../../mol-plugin-ui/react18';
|
||||
import { PluginUIContext } from '../../mol-plugin-ui/context';
|
||||
import { DefaultPluginUISpec } from '../../mol-plugin-ui/spec';
|
||||
import { PluginCommands } from '../../mol-plugin/commands';
|
||||
|
||||
@@ -10,7 +10,7 @@ import { AnimateModelIndex } from '../../mol-plugin-state/animation/built-in/mod
|
||||
import { createStructureRepresentationParams } from '../../mol-plugin-state/helpers/structure-representation-params';
|
||||
import { PluginStateObject, PluginStateObject as PSO } from '../../mol-plugin-state/objects';
|
||||
import { StateTransforms } from '../../mol-plugin-state/transforms';
|
||||
import { createPluginUI } from '../../mol-plugin-ui';
|
||||
import { createPluginUI } from '../../mol-plugin-ui/react18';
|
||||
import { PluginUIContext } from '../../mol-plugin-ui/context';
|
||||
import { DefaultPluginUISpec } from '../../mol-plugin-ui/spec';
|
||||
import { CreateVolumeStreamingInfo, InitVolumeStreaming } from '../../mol-plugin/behavior/dynamic/volume-streaming/transformers';
|
||||
|
||||
@@ -11,149 +11,248 @@ import { Location } from '../../../mol-model/location';
|
||||
import { CustomProperty } from '../../../mol-model-props/common/custom-property';
|
||||
import { ColorTheme } from '../../../mol-theme/color';
|
||||
import { ThemeDataContext } from '../../../mol-theme/theme';
|
||||
import { Color } from '../../../mol-util/color';
|
||||
import { Color, ColorMap } from '../../../mol-util/color';
|
||||
import { getColorMapParams } from '../../../mol-util/color/params';
|
||||
import { ParamDefinition as PD } from '../../../mol-util/param-definition';
|
||||
import { TableLegend } from '../../../mol-util/legend';
|
||||
import { iterableToArray } from '../../../mol-data/util';
|
||||
import { ObjectKeys } from '../../../mol-util/type-helpers';
|
||||
|
||||
const DefaultColor = Color(0xCCCCCC);
|
||||
const Description = 'Assigns colors to confal pyramids';
|
||||
|
||||
const DefaultClassColors = {
|
||||
A: 0xFFC1C1,
|
||||
B: 0xC8CFFF,
|
||||
BII: 0x0059DA,
|
||||
miB: 0x3BE8FB,
|
||||
Z: 0x01F60E,
|
||||
IC: 0xFA5CFB,
|
||||
OPN: 0xE90000,
|
||||
SYN: 0xFFFF01,
|
||||
N: 0xF2F2F2,
|
||||
};
|
||||
const ErrorColor = Color(0xFFA10A);
|
||||
|
||||
type ConformerClasses = 'A' | 'B' | 'BII' | 'miB' | 'Z' | 'IC' | 'OPN' | 'SYN' | 'N';
|
||||
const PyramidsColors = ColorMap({
|
||||
NANT_Upr: DefaultClassColors.N,
|
||||
NANT_Lwr: DefaultClassColors.N,
|
||||
AA00_Upr: DefaultClassColors.A,
|
||||
AA00_Lwr: DefaultClassColors.A,
|
||||
AA02_Upr: DefaultClassColors.A,
|
||||
AA02_Lwr: DefaultClassColors.A,
|
||||
AA03_Upr: DefaultClassColors.A,
|
||||
AA03_Lwr: DefaultClassColors.A,
|
||||
AA04_Upr: DefaultClassColors.A,
|
||||
AA04_Lwr: DefaultClassColors.A,
|
||||
AA08_Upr: DefaultClassColors.A,
|
||||
AA08_Lwr: DefaultClassColors.A,
|
||||
AA09_Upr: DefaultClassColors.A,
|
||||
AA09_Lwr: DefaultClassColors.A,
|
||||
AA01_Upr: DefaultClassColors.A,
|
||||
AA01_Lwr: DefaultClassColors.A,
|
||||
AA05_Upr: DefaultClassColors.A,
|
||||
AA05_Lwr: DefaultClassColors.A,
|
||||
AA06_Upr: DefaultClassColors.A,
|
||||
AA06_Lwr: DefaultClassColors.A,
|
||||
AA10_Upr: DefaultClassColors.A,
|
||||
AA10_Lwr: DefaultClassColors.A,
|
||||
AA11_Upr: DefaultClassColors.A,
|
||||
AA11_Lwr: DefaultClassColors.A,
|
||||
AA07_Upr: DefaultClassColors.A,
|
||||
AA07_Lwr: DefaultClassColors.A,
|
||||
AA12_Upr: DefaultClassColors.A,
|
||||
AA12_Lwr: DefaultClassColors.A,
|
||||
AA13_Upr: DefaultClassColors.A,
|
||||
AA13_Lwr: DefaultClassColors.A,
|
||||
AB01_Upr: DefaultClassColors.A,
|
||||
AB01_Lwr: DefaultClassColors.B,
|
||||
AB02_Upr: DefaultClassColors.A,
|
||||
AB02_Lwr: DefaultClassColors.B,
|
||||
AB03_Upr: DefaultClassColors.A,
|
||||
AB03_Lwr: DefaultClassColors.B,
|
||||
AB04_Upr: DefaultClassColors.A,
|
||||
AB04_Lwr: DefaultClassColors.B,
|
||||
AB05_Upr: DefaultClassColors.A,
|
||||
AB05_Lwr: DefaultClassColors.B,
|
||||
BA01_Upr: DefaultClassColors.B,
|
||||
BA01_Lwr: DefaultClassColors.A,
|
||||
BA05_Upr: DefaultClassColors.B,
|
||||
BA05_Lwr: DefaultClassColors.A,
|
||||
BA09_Upr: DefaultClassColors.B,
|
||||
BA09_Lwr: DefaultClassColors.A,
|
||||
BA08_Upr: DefaultClassColors.BII,
|
||||
BA08_Lwr: DefaultClassColors.A,
|
||||
BA10_Upr: DefaultClassColors.B,
|
||||
BA10_Lwr: DefaultClassColors.A,
|
||||
BA13_Upr: DefaultClassColors.BII,
|
||||
BA13_Lwr: DefaultClassColors.A,
|
||||
BA16_Upr: DefaultClassColors.BII,
|
||||
BA16_Lwr: DefaultClassColors.A,
|
||||
BA17_Upr: DefaultClassColors.BII,
|
||||
BA17_Lwr: DefaultClassColors.A,
|
||||
BB00_Upr: DefaultClassColors.B,
|
||||
BB00_Lwr: DefaultClassColors.B,
|
||||
BB01_Upr: DefaultClassColors.B,
|
||||
BB01_Lwr: DefaultClassColors.B,
|
||||
BB17_Upr: DefaultClassColors.B,
|
||||
BB17_Lwr: DefaultClassColors.B,
|
||||
BB02_Upr: DefaultClassColors.B,
|
||||
BB02_Lwr: DefaultClassColors.B,
|
||||
BB03_Upr: DefaultClassColors.B,
|
||||
BB03_Lwr: DefaultClassColors.B,
|
||||
BB11_Upr: DefaultClassColors.B,
|
||||
BB11_Lwr: DefaultClassColors.B,
|
||||
BB16_Upr: DefaultClassColors.B,
|
||||
BB16_Lwr: DefaultClassColors.B,
|
||||
BB04_Upr: DefaultClassColors.B,
|
||||
BB04_Lwr: DefaultClassColors.BII,
|
||||
BB05_Upr: DefaultClassColors.B,
|
||||
BB05_Lwr: DefaultClassColors.BII,
|
||||
BB07_Upr: DefaultClassColors.BII,
|
||||
BB07_Lwr: DefaultClassColors.BII,
|
||||
BB08_Upr: DefaultClassColors.BII,
|
||||
BB08_Lwr: DefaultClassColors.BII,
|
||||
BB10_Upr: DefaultClassColors.miB,
|
||||
BB10_Lwr: DefaultClassColors.miB,
|
||||
BB12_Upr: DefaultClassColors.miB,
|
||||
BB12_Lwr: DefaultClassColors.miB,
|
||||
BB13_Upr: DefaultClassColors.miB,
|
||||
BB13_Lwr: DefaultClassColors.miB,
|
||||
BB14_Upr: DefaultClassColors.miB,
|
||||
BB14_Lwr: DefaultClassColors.miB,
|
||||
BB15_Upr: DefaultClassColors.miB,
|
||||
BB15_Lwr: DefaultClassColors.miB,
|
||||
BB20_Upr: DefaultClassColors.miB,
|
||||
BB20_Lwr: DefaultClassColors.miB,
|
||||
IC01_Upr: DefaultClassColors.IC,
|
||||
IC01_Lwr: DefaultClassColors.IC,
|
||||
IC02_Upr: DefaultClassColors.IC,
|
||||
IC02_Lwr: DefaultClassColors.IC,
|
||||
IC03_Upr: DefaultClassColors.IC,
|
||||
IC03_Lwr: DefaultClassColors.IC,
|
||||
IC04_Upr: DefaultClassColors.IC,
|
||||
IC04_Lwr: DefaultClassColors.IC,
|
||||
IC05_Upr: DefaultClassColors.IC,
|
||||
IC05_Lwr: DefaultClassColors.IC,
|
||||
IC06_Upr: DefaultClassColors.IC,
|
||||
IC06_Lwr: DefaultClassColors.IC,
|
||||
IC07_Upr: DefaultClassColors.IC,
|
||||
IC07_Lwr: DefaultClassColors.IC,
|
||||
OP01_Upr: DefaultClassColors.OPN,
|
||||
OP01_Lwr: DefaultClassColors.OPN,
|
||||
OP02_Upr: DefaultClassColors.OPN,
|
||||
OP02_Lwr: DefaultClassColors.OPN,
|
||||
OP03_Upr: DefaultClassColors.OPN,
|
||||
OP03_Lwr: DefaultClassColors.OPN,
|
||||
OP04_Upr: DefaultClassColors.OPN,
|
||||
OP04_Lwr: DefaultClassColors.OPN,
|
||||
OP05_Upr: DefaultClassColors.OPN,
|
||||
OP05_Lwr: DefaultClassColors.OPN,
|
||||
OP06_Upr: DefaultClassColors.OPN,
|
||||
OP06_Lwr: DefaultClassColors.OPN,
|
||||
OP07_Upr: DefaultClassColors.OPN,
|
||||
OP07_Lwr: DefaultClassColors.OPN,
|
||||
OP08_Upr: DefaultClassColors.OPN,
|
||||
OP08_Lwr: DefaultClassColors.OPN,
|
||||
OP09_Upr: DefaultClassColors.OPN,
|
||||
OP09_Lwr: DefaultClassColors.OPN,
|
||||
OP10_Upr: DefaultClassColors.OPN,
|
||||
OP10_Lwr: DefaultClassColors.OPN,
|
||||
OP11_Upr: DefaultClassColors.OPN,
|
||||
OP11_Lwr: DefaultClassColors.OPN,
|
||||
OP12_Upr: DefaultClassColors.OPN,
|
||||
OP12_Lwr: DefaultClassColors.OPN,
|
||||
OP13_Upr: DefaultClassColors.OPN,
|
||||
OP13_Lwr: DefaultClassColors.OPN,
|
||||
OP14_Upr: DefaultClassColors.OPN,
|
||||
OP14_Lwr: DefaultClassColors.OPN,
|
||||
OP15_Upr: DefaultClassColors.OPN,
|
||||
OP15_Lwr: DefaultClassColors.OPN,
|
||||
OP16_Upr: DefaultClassColors.OPN,
|
||||
OP16_Lwr: DefaultClassColors.OPN,
|
||||
OP17_Upr: DefaultClassColors.OPN,
|
||||
OP17_Lwr: DefaultClassColors.OPN,
|
||||
OP18_Upr: DefaultClassColors.OPN,
|
||||
OP18_Lwr: DefaultClassColors.OPN,
|
||||
OP19_Upr: DefaultClassColors.OPN,
|
||||
OP19_Lwr: DefaultClassColors.OPN,
|
||||
OP20_Upr: DefaultClassColors.OPN,
|
||||
OP20_Lwr: DefaultClassColors.OPN,
|
||||
OP21_Upr: DefaultClassColors.OPN,
|
||||
OP21_Lwr: DefaultClassColors.OPN,
|
||||
OP22_Upr: DefaultClassColors.OPN,
|
||||
OP22_Lwr: DefaultClassColors.OPN,
|
||||
OP23_Upr: DefaultClassColors.OPN,
|
||||
OP23_Lwr: DefaultClassColors.OPN,
|
||||
OP24_Upr: DefaultClassColors.OPN,
|
||||
OP24_Lwr: DefaultClassColors.OPN,
|
||||
OP25_Upr: DefaultClassColors.OPN,
|
||||
OP25_Lwr: DefaultClassColors.OPN,
|
||||
OP26_Upr: DefaultClassColors.OPN,
|
||||
OP26_Lwr: DefaultClassColors.OPN,
|
||||
OP27_Upr: DefaultClassColors.OPN,
|
||||
OP27_Lwr: DefaultClassColors.OPN,
|
||||
OP28_Upr: DefaultClassColors.OPN,
|
||||
OP28_Lwr: DefaultClassColors.OPN,
|
||||
OP29_Upr: DefaultClassColors.OPN,
|
||||
OP29_Lwr: DefaultClassColors.OPN,
|
||||
OP30_Upr: DefaultClassColors.OPN,
|
||||
OP30_Lwr: DefaultClassColors.OPN,
|
||||
OP31_Upr: DefaultClassColors.OPN,
|
||||
OP31_Lwr: DefaultClassColors.OPN,
|
||||
OPS1_Upr: DefaultClassColors.OPN,
|
||||
OPS1_Lwr: DefaultClassColors.OPN,
|
||||
OP1S_Upr: DefaultClassColors.OPN,
|
||||
OP1S_Lwr: DefaultClassColors.SYN,
|
||||
AAS1_Upr: DefaultClassColors.SYN,
|
||||
AAS1_Lwr: DefaultClassColors.A,
|
||||
AB1S_Upr: DefaultClassColors.A,
|
||||
AB1S_Lwr: DefaultClassColors.SYN,
|
||||
AB2S_Upr: DefaultClassColors.A,
|
||||
AB2S_Lwr: DefaultClassColors.SYN,
|
||||
BB1S_Upr: DefaultClassColors.B,
|
||||
BB1S_Lwr: DefaultClassColors.SYN,
|
||||
BB2S_Upr: DefaultClassColors.B,
|
||||
BB2S_Lwr: DefaultClassColors.SYN,
|
||||
BBS1_Upr: DefaultClassColors.SYN,
|
||||
BBS1_Lwr: DefaultClassColors.B,
|
||||
ZZ01_Upr: DefaultClassColors.Z,
|
||||
ZZ01_Lwr: DefaultClassColors.Z,
|
||||
ZZ02_Upr: DefaultClassColors.Z,
|
||||
ZZ02_Lwr: DefaultClassColors.Z,
|
||||
ZZ1S_Upr: DefaultClassColors.Z,
|
||||
ZZ1S_Lwr: DefaultClassColors.SYN,
|
||||
ZZ2S_Upr: DefaultClassColors.Z,
|
||||
ZZ2S_Lwr: DefaultClassColors.SYN,
|
||||
ZZS1_Upr: DefaultClassColors.SYN,
|
||||
ZZS1_Lwr: DefaultClassColors.Z,
|
||||
ZZS2_Upr: DefaultClassColors.SYN,
|
||||
ZZS2_Lwr: DefaultClassColors.Z,
|
||||
});
|
||||
type PyramidsColors = typeof PyramidsColors;
|
||||
|
||||
const ColorMapping: ReadonlyMap<ConformerClasses, Color> = new Map([
|
||||
['A', Color(0xFFC1C1)],
|
||||
['B', Color(0xC8CFFF)],
|
||||
['BII', Color(0x0059DA)],
|
||||
['miB', Color(0x3BE8FB)],
|
||||
['Z', Color(0x01F60E)],
|
||||
['IC', Color(0xFA5CFB)],
|
||||
['OPN', Color(0xE90000)],
|
||||
['SYN', Color(0xFFFF01)],
|
||||
['N', Color(0xF2F2F2)],
|
||||
]);
|
||||
export const ConfalPyramidsColorThemeParams = {
|
||||
colors: PD.MappedStatic('default', {
|
||||
'default': PD.EmptyGroup(),
|
||||
'custom': PD.Group(getColorMapParams(PyramidsColors))
|
||||
}),
|
||||
};
|
||||
export type ConfalPyramidsColorThemeParams = typeof ConfalPyramidsColorThemeParams;
|
||||
|
||||
const NtCToClasses: ReadonlyMap<string, [ConformerClasses, ConformerClasses]> = new Map([
|
||||
['NANT', ['N', 'N']],
|
||||
['AA00', ['A', 'A']],
|
||||
['AA02', ['A', 'A']],
|
||||
['AA03', ['A', 'A']],
|
||||
['AA04', ['A', 'A']],
|
||||
['AA08', ['A', 'A']],
|
||||
['AA09', ['A', 'A']],
|
||||
['AA01', ['A', 'A']],
|
||||
['AA05', ['A', 'A']],
|
||||
['AA06', ['A', 'A']],
|
||||
['AA10', ['A', 'A']],
|
||||
['AA11', ['A', 'A']],
|
||||
['AA07', ['A', 'A']],
|
||||
['AA12', ['A', 'A']],
|
||||
['AA13', ['A', 'A']],
|
||||
['AB01', ['A', 'B']],
|
||||
['AB02', ['A', 'B']],
|
||||
['AB03', ['A', 'B']],
|
||||
['AB04', ['A', 'B']],
|
||||
['AB05', ['A', 'B']],
|
||||
['BA01', ['B', 'A']],
|
||||
['BA05', ['B', 'A']],
|
||||
['BA09', ['B', 'A']],
|
||||
['BA08', ['BII', 'A']],
|
||||
['BA10', ['B', 'A']],
|
||||
['BA13', ['BII', 'A']],
|
||||
['BA16', ['BII', 'A']],
|
||||
['BA17', ['BII', 'A']],
|
||||
['BB00', ['B', 'B']],
|
||||
['BB01', ['B', 'B']],
|
||||
['BB17', ['B', 'B']],
|
||||
['BB02', ['B', 'B']],
|
||||
['BB03', ['B', 'B']],
|
||||
['BB11', ['B', 'B']],
|
||||
['BB16', ['B', 'B']],
|
||||
['BB04', ['B', 'BII']],
|
||||
['BB05', ['B', 'BII']],
|
||||
['BB07', ['BII', 'BII']],
|
||||
['BB08', ['BII', 'BII']],
|
||||
['BB10', ['miB', 'miB']],
|
||||
['BB12', ['miB', 'miB']],
|
||||
['BB13', ['miB', 'miB']],
|
||||
['BB14', ['miB', 'miB']],
|
||||
['BB15', ['miB', 'miB']],
|
||||
['BB20', ['miB', 'miB']],
|
||||
['IC01', ['IC', 'IC']],
|
||||
['IC02', ['IC', 'IC']],
|
||||
['IC03', ['IC', 'IC']],
|
||||
['IC04', ['IC', 'IC']],
|
||||
['IC05', ['IC', 'IC']],
|
||||
['IC06', ['IC', 'IC']],
|
||||
['IC07', ['IC', 'IC']],
|
||||
['OP01', ['OPN', 'OPN']],
|
||||
['OP02', ['OPN', 'OPN']],
|
||||
['OP03', ['OPN', 'OPN']],
|
||||
['OP04', ['OPN', 'OPN']],
|
||||
['OP05', ['OPN', 'OPN']],
|
||||
['OP06', ['OPN', 'OPN']],
|
||||
['OP07', ['OPN', 'OPN']],
|
||||
['OP08', ['OPN', 'OPN']],
|
||||
['OP09', ['OPN', 'OPN']],
|
||||
['OP10', ['OPN', 'OPN']],
|
||||
['OP11', ['OPN', 'OPN']],
|
||||
['OP12', ['OPN', 'OPN']],
|
||||
['OP13', ['OPN', 'OPN']],
|
||||
['OP14', ['OPN', 'OPN']],
|
||||
['OP15', ['OPN', 'OPN']],
|
||||
['OP16', ['OPN', 'OPN']],
|
||||
['OP17', ['OPN', 'OPN']],
|
||||
['OP18', ['OPN', 'OPN']],
|
||||
['OP19', ['OPN', 'OPN']],
|
||||
['OP20', ['OPN', 'OPN']],
|
||||
['OP21', ['OPN', 'OPN']],
|
||||
['OP22', ['OPN', 'OPN']],
|
||||
['OP23', ['OPN', 'OPN']],
|
||||
['OP24', ['OPN', 'OPN']],
|
||||
['OP25', ['OPN', 'OPN']],
|
||||
['OP26', ['OPN', 'OPN']],
|
||||
['OP27', ['OPN', 'OPN']],
|
||||
['OP28', ['OPN', 'OPN']],
|
||||
['OP29', ['OPN', 'OPN']],
|
||||
['OP30', ['OPN', 'OPN']],
|
||||
['OP31', ['OPN', 'OPN']],
|
||||
['OPS1', ['OPN', 'OPN']],
|
||||
['OP1S', ['OPN', 'SYN']],
|
||||
['AAS1', ['SYN', 'A']],
|
||||
['AB1S', ['A', 'SYN']],
|
||||
['AB2S', ['A', 'SYN']],
|
||||
['BB1S', ['B', 'SYN']],
|
||||
['BB2S', ['B', 'SYN']],
|
||||
['BBS1', ['SYN', 'B']],
|
||||
['ZZ01', ['Z', 'Z']],
|
||||
['ZZ02', ['Z', 'Z']],
|
||||
['ZZ1S', ['Z', 'SYN']],
|
||||
['ZZ2S', ['Z', 'SYN']],
|
||||
['ZZS1', ['SYN', 'Z']],
|
||||
['ZZS2', ['SYN', 'Z']],
|
||||
]);
|
||||
|
||||
function getConformerColor(ntc: string, useLower: boolean): Color {
|
||||
const item = NtCToClasses.get(ntc);
|
||||
if (!item) return ErrorColor;
|
||||
return ColorMapping.get(useLower ? item[1] : item[0]) ?? ErrorColor;
|
||||
}
|
||||
|
||||
export const ConfalPyramidsColorThemeParams = {};
|
||||
export type ConfalPyramidsColorThemeParams = typeof ConfalPyramidsColorThemeParams
|
||||
export function getConfalPyramidsColorThemeParams(ctx: ThemeDataContext) {
|
||||
return ConfalPyramidsColorThemeParams; // TODO return copy
|
||||
return PD.clone(ConfalPyramidsColorThemeParams);
|
||||
}
|
||||
|
||||
export function ConfalPyramidsColorTheme(ctx: ThemeDataContext, props: PD.Values<ConfalPyramidsColorThemeParams>): ColorTheme<ConfalPyramidsColorThemeParams> {
|
||||
const colorMap = props.colors.name === 'default' ? PyramidsColors : props.colors.params;
|
||||
|
||||
function color(location: Location, isSecondary: boolean): Color {
|
||||
if (CPT.isLocation(location)) {
|
||||
const { pyramid, isLower } = location.data;
|
||||
return getConformerColor(pyramid.NtC, isLower);
|
||||
const key = pyramid.NtC + `_${isLower ? 'Lwr' : 'Upr'}` as keyof PyramidsColors;
|
||||
return colorMap[key] ?? ErrorColor;
|
||||
}
|
||||
|
||||
return DefaultColor;
|
||||
return ErrorColor;
|
||||
}
|
||||
|
||||
return {
|
||||
@@ -162,12 +261,7 @@ export function ConfalPyramidsColorTheme(ctx: ThemeDataContext, props: PD.Values
|
||||
color,
|
||||
props,
|
||||
description: Description,
|
||||
legend: TableLegend(iterableToArray(ColorMapping.entries()).map(([conformer, color]) => {
|
||||
return [conformer, color] as [string, Color];
|
||||
}).concat([
|
||||
['Error', ErrorColor],
|
||||
['Unknown', DefaultColor]
|
||||
]))
|
||||
legend: TableLegend(ObjectKeys(colorMap).map(k => [k.replace('_', ' '), colorMap[k]] as [string, Color]).concat([['Error', ErrorColor]])),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -123,10 +123,8 @@ function createPyramidsFromCif(model: Model,
|
||||
|
||||
for (let i = 0; i < _rowCount; i++) {
|
||||
const model_num = PDB_model_number.value(i);
|
||||
if (model_num !== model.modelNum) {
|
||||
if (model_num !== model.modelNum)
|
||||
hasMultipleModels = true;
|
||||
continue; // We are only interested in data for the current model
|
||||
}
|
||||
|
||||
const { _NtC, _confal_score } = getNtCAndConfalScore(id.value(i), i, stepsSummary);
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
import { ConfalPyramidsProvider } from './property';
|
||||
import { ConfalPyramidsTypes as CPT } from './types';
|
||||
import { OrderedSet, Segmentation } from '../../../mol-data/int';
|
||||
import { Segmentation } from '../../../mol-data/int';
|
||||
import { Vec3 } from '../../../mol-math/linear-algebra';
|
||||
import { ChainIndex, ElementIndex, ResidueIndex, Structure, StructureElement, StructureProperties, Unit } from '../../../mol-model/structure';
|
||||
|
||||
@@ -63,15 +63,12 @@ export namespace ConfalPyramidsUtil {
|
||||
return prop.data.hasMultipleModels;
|
||||
}
|
||||
|
||||
function getPossibleAltIdsIndices(eIFirst: ElementIndex, eILast: ElementIndex, structure: Structure, unit: Unit.Atomic): string[] {
|
||||
const loc = StructureElement.Location.create(structure, unit, -1 as ElementIndex);
|
||||
|
||||
const uIFirst = OrderedSet.indexOf(unit.elements, eIFirst);
|
||||
const uILast = OrderedSet.indexOf(unit.elements, eILast);
|
||||
|
||||
function getPossibleAltIds(residue: Residue, structure: Structure, unit: Unit.Atomic): string[] {
|
||||
const possibleAltIds: string[] = [];
|
||||
for (let uI = uIFirst; uI <= uILast; uI++) {
|
||||
loc.element = unit.elements[uI];
|
||||
|
||||
const loc = StructureElement.Location.create(structure, unit, -1 as ElementIndex);
|
||||
for (let rI = residue.start; rI <= residue.end - 1; rI++) {
|
||||
loc.element = unit.elements[rI];
|
||||
const altId = StructureProperties.atom.label_alt_id(loc);
|
||||
if (altId !== '' && !possibleAltIds.includes(altId)) possibleAltIds.push(altId);
|
||||
}
|
||||
@@ -79,10 +76,6 @@ export namespace ConfalPyramidsUtil {
|
||||
return possibleAltIds;
|
||||
}
|
||||
|
||||
function getPossibleAltIdsResidue(residue: Residue, structure: Structure, unit: Unit.Atomic): string[] {
|
||||
return getPossibleAltIdsIndices(unit.elements[residue.start], unit.elements[residue.end - 1], structure, unit);
|
||||
}
|
||||
|
||||
class Utility {
|
||||
protected getPyramidByName(name: string): { pyramid: CPT.Pyramid | undefined, index: number } {
|
||||
const index = this.data.names.get(name);
|
||||
@@ -122,19 +115,22 @@ export namespace ConfalPyramidsUtil {
|
||||
|
||||
export class UnitWalker extends Utility {
|
||||
private getAtomIndices(names: string[], residue: Residue): ElementIndex[] {
|
||||
let rI = residue.start;
|
||||
const rILast = residue.end - 1;
|
||||
const indices: ElementIndex[] = [];
|
||||
|
||||
for (; rI !== rILast; rI++) {
|
||||
const eI = this.unit.elements[rI];
|
||||
const loc = StructureElement.Location.create(this.structure, this.unit, eI);
|
||||
const loc = StructureElement.Location.create(this.structure, this.unit, -1 as ElementIndex);
|
||||
for (let rI = residue.start; rI <= residue.end - 1; rI++) {
|
||||
loc.element = this.unit.elements[rI];
|
||||
const thisName = StructureProperties.atom.label_atom_id(loc);
|
||||
if (names.includes(thisName)) indices.push(eI);
|
||||
if (names.includes(thisName)) indices.push(loc.element);
|
||||
}
|
||||
|
||||
if (indices.length === 0)
|
||||
throw new Error(`Element ${name} not found on residue ${residue.index}`);
|
||||
if (indices.length === 0) {
|
||||
let namesStr = '';
|
||||
for (const n of names)
|
||||
namesStr += `${n} `;
|
||||
|
||||
throw new Error(`Element [${namesStr}] not found on residue ${residue.index}`);
|
||||
}
|
||||
|
||||
return indices;
|
||||
}
|
||||
@@ -257,12 +253,12 @@ export namespace ConfalPyramidsUtil {
|
||||
}
|
||||
|
||||
private step(residue: Residue): { firstAtoms: FirstResidueAtoms[], secondAtoms: SecondResidueAtoms[] } {
|
||||
const firstPossibleAltIds = getPossibleAltIdsResidue(residue, this.structure, this.unit);
|
||||
const firstPossibleAltIds = getPossibleAltIds(residue, this.structure, this.unit);
|
||||
const firstAtoms = this.processFirstResidue(residue, firstPossibleAltIds);
|
||||
|
||||
residue = this.residueIt.move();
|
||||
|
||||
const secondPossibleAltIds = getPossibleAltIdsResidue(residue, this.structure, this.unit);
|
||||
const secondPossibleAltIds = getPossibleAltIds(residue, this.structure, this.unit);
|
||||
const secondAtoms = this.processSecondResidue(residue, secondPossibleAltIds);
|
||||
|
||||
return { firstAtoms, secondAtoms };
|
||||
|
||||
@@ -4,7 +4,7 @@ export type InputMaybe<T> = Maybe<T>;
|
||||
export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
|
||||
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
|
||||
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
|
||||
// Generated on 2022-02-27T12:49:36-08:00
|
||||
// Generated on 2022-04-30T15:35:08-07:00
|
||||
|
||||
/** All built-in and custom scalars, mapped to their actual values */
|
||||
export type Scalars = {
|
||||
@@ -659,6 +659,8 @@ export type CoreEntry = {
|
||||
readonly em_staining?: Maybe<ReadonlyArray<Maybe<EmStaining>>>;
|
||||
readonly em_vitrification?: Maybe<ReadonlyArray<Maybe<EmVitrification>>>;
|
||||
readonly entry?: Maybe<Entry>;
|
||||
/** Get all groups for this PDB entry. */
|
||||
readonly entry_groups?: Maybe<ReadonlyArray<Maybe<GroupEntry>>>;
|
||||
readonly exptl?: Maybe<ReadonlyArray<Maybe<Exptl>>>;
|
||||
readonly exptl_crystal?: Maybe<ReadonlyArray<Maybe<ExptlCrystal>>>;
|
||||
readonly exptl_crystal_grow?: Maybe<ReadonlyArray<Maybe<ExptlCrystalGrow>>>;
|
||||
@@ -703,6 +705,7 @@ export type CoreEntry = {
|
||||
readonly rcsb_associated_holdings?: Maybe<CurrentEntry>;
|
||||
readonly rcsb_binding_affinity?: Maybe<ReadonlyArray<Maybe<RcsbBindingAffinity>>>;
|
||||
readonly rcsb_entry_container_identifiers: RcsbEntryContainerIdentifiers;
|
||||
readonly rcsb_entry_group_membership?: Maybe<ReadonlyArray<Maybe<RcsbEntryGroupMembership>>>;
|
||||
readonly rcsb_entry_info: RcsbEntryInfo;
|
||||
readonly rcsb_external_references?: Maybe<ReadonlyArray<Maybe<RcsbExternalReferences>>>;
|
||||
/**
|
||||
@@ -851,6 +854,8 @@ export type CorePolymerEntity = {
|
||||
readonly pdbx_entity_src_syn?: Maybe<ReadonlyArray<Maybe<PdbxEntitySrcSyn>>>;
|
||||
/** Get all unique Pfam annotations associated with this molecular entity. */
|
||||
readonly pfams?: Maybe<ReadonlyArray<Maybe<CorePfam>>>;
|
||||
/** Get all groups for this PDB entity. */
|
||||
readonly polymer_entity_groups?: Maybe<ReadonlyArray<Maybe<GroupPolymerEntity>>>;
|
||||
/** Get all unique polymer instances (chains) for this molecular entity. */
|
||||
readonly polymer_entity_instances?: Maybe<ReadonlyArray<Maybe<CorePolymerEntityInstance>>>;
|
||||
/** Get a BIRD chemical components described in this molecular entity. */
|
||||
@@ -887,6 +892,7 @@ export type CorePolymerEntity = {
|
||||
readonly rcsb_polymer_entity_container_identifiers: RcsbPolymerEntityContainerIdentifiers;
|
||||
readonly rcsb_polymer_entity_feature?: Maybe<ReadonlyArray<Maybe<RcsbPolymerEntityFeature>>>;
|
||||
readonly rcsb_polymer_entity_feature_summary?: Maybe<ReadonlyArray<Maybe<RcsbPolymerEntityFeatureSummary>>>;
|
||||
readonly rcsb_polymer_entity_group_membership?: Maybe<ReadonlyArray<Maybe<RcsbPolymerEntityGroupMembership>>>;
|
||||
readonly rcsb_polymer_entity_keywords?: Maybe<RcsbPolymerEntityKeywords>;
|
||||
readonly rcsb_polymer_entity_name_com?: Maybe<ReadonlyArray<Maybe<RcsbPolymerEntityNameCom>>>;
|
||||
readonly rcsb_polymer_entity_name_sys?: Maybe<ReadonlyArray<Maybe<RcsbPolymerEntityNameSys>>>;
|
||||
@@ -3198,6 +3204,55 @@ export type GeneName = {
|
||||
readonly value?: Maybe<Scalars['String']>;
|
||||
};
|
||||
|
||||
export type GroupEntry = {
|
||||
/** Get provenance associated with this group. */
|
||||
readonly group_provenance?: Maybe<GroupProvenance>;
|
||||
readonly rcsb_group_accession_info?: Maybe<RcsbGroupAccessionInfo>;
|
||||
readonly rcsb_group_container_identifiers: RcsbGroupContainerIdentifiers;
|
||||
readonly rcsb_group_info: RcsbGroupInfo;
|
||||
readonly rcsb_group_related?: Maybe<ReadonlyArray<Maybe<RcsbGroupRelated>>>;
|
||||
readonly rcsb_group_statistics?: Maybe<RcsbGroupStatistics>;
|
||||
/** A unique textual identifier for a group */
|
||||
readonly rcsb_id: Scalars['String'];
|
||||
};
|
||||
|
||||
export type GroupMembersAlignmentAlignedRegions = {
|
||||
/** Aligned region length */
|
||||
readonly length: Scalars['Int'];
|
||||
/** Entity seqeunce start position */
|
||||
readonly query_begin: Scalars['Int'];
|
||||
/** NCBI sequence start position */
|
||||
readonly target_begin: Scalars['Int'];
|
||||
};
|
||||
|
||||
export type GroupMembersAlignmentScores = {
|
||||
readonly query_coverage: Scalars['Int'];
|
||||
readonly query_length: Scalars['Int'];
|
||||
readonly target_coverage: Scalars['Int'];
|
||||
readonly target_length: Scalars['Int'];
|
||||
};
|
||||
|
||||
export type GroupPolymerEntity = {
|
||||
/** Get provenance associated with this group. */
|
||||
readonly group_provenance?: Maybe<GroupProvenance>;
|
||||
readonly rcsb_group_accession_info?: Maybe<RcsbGroupAccessionInfo>;
|
||||
readonly rcsb_group_container_identifiers: RcsbGroupContainerIdentifiers;
|
||||
readonly rcsb_group_info: RcsbGroupInfo;
|
||||
readonly rcsb_group_related?: Maybe<ReadonlyArray<Maybe<RcsbGroupRelated>>>;
|
||||
readonly rcsb_group_statistics?: Maybe<RcsbGroupStatistics>;
|
||||
/** A unique textual identifier for a group */
|
||||
readonly rcsb_id: Scalars['String'];
|
||||
readonly rcsb_polymer_entity_group_members_rankings?: Maybe<ReadonlyArray<Maybe<RcsbPolymerEntityGroupMembersRankings>>>;
|
||||
readonly rcsb_polymer_entity_group_sequence_alignment?: Maybe<RcsbPolymerEntityGroupSequenceAlignment>;
|
||||
};
|
||||
|
||||
export type GroupProvenance = {
|
||||
readonly rcsb_group_aggregation_method?: Maybe<RcsbGroupAggregationMethod>;
|
||||
readonly rcsb_group_provenance_container_identifiers?: Maybe<RcsbGroupProvenanceContainerIdentifiers>;
|
||||
/** A unique textual identifier for a group provenance */
|
||||
readonly rcsb_id?: Maybe<Scalars['String']>;
|
||||
};
|
||||
|
||||
export type InterfacePartnerFeatureAdditionalProperties = {
|
||||
/**
|
||||
* The additional property name.
|
||||
@@ -3220,6 +3275,17 @@ export type InterfacePartnerFeatureFeaturePositions = {
|
||||
readonly values?: Maybe<ReadonlyArray<Maybe<Scalars['Float']>>>;
|
||||
};
|
||||
|
||||
export type MethodDetails = {
|
||||
/** A description of special aspects of the clustering process */
|
||||
readonly description?: Maybe<Scalars['String']>;
|
||||
/** Defines the name of the description associated with the clustering process */
|
||||
readonly name?: Maybe<Scalars['String']>;
|
||||
/** Defines the type of the description associated with the clustering process */
|
||||
readonly type?: Maybe<Scalars['String']>;
|
||||
/** Defines the value associated with the clustering process */
|
||||
readonly value?: Maybe<Scalars['Float']>;
|
||||
};
|
||||
|
||||
export type PdbxAuditRevisionCategory = {
|
||||
/**
|
||||
* The category updated in the pdbx_audit_revision_category record.
|
||||
@@ -6779,6 +6845,12 @@ export type Query = {
|
||||
readonly entries?: Maybe<ReadonlyArray<Maybe<CoreEntry>>>;
|
||||
/** Get PDB entry given the PDB id. */
|
||||
readonly entry?: Maybe<CoreEntry>;
|
||||
/** Given a group ID get a group object formed by aggregating individual structures that share a degree of similarity */
|
||||
readonly entry_group?: Maybe<GroupEntry>;
|
||||
/** Given a list of group IDs get a list of group objects formed by aggregating structures that share a degree of similarity */
|
||||
readonly entry_groups?: Maybe<ReadonlyArray<Maybe<GroupEntry>>>;
|
||||
/** Given a group provenance ID get an object that describes aggregation method used to create groups */
|
||||
readonly group_provenance?: Maybe<GroupProvenance>;
|
||||
/** Get a pairwise polymeric interface given the PDB ID, ASSEMBLY ID and INTERFACE ID. */
|
||||
readonly interface?: Maybe<CoreInterface>;
|
||||
/** Get a list of pairwise polymeric interfaces given a list of INTERFACE IDs. Here INTERFACE ID is a compound identifier that includes entry_id, assembly_id and interface_id e.g. 1XXX-1.1. */
|
||||
@@ -6795,6 +6867,10 @@ export type Query = {
|
||||
readonly polymer_entities?: Maybe<ReadonlyArray<Maybe<CorePolymerEntity>>>;
|
||||
/** Get a PDB polymer entity, given the PDB ID and ENTITY ID. Here ENTITY ID is a '1', '2', '3', etc. */
|
||||
readonly polymer_entity?: Maybe<CorePolymerEntity>;
|
||||
/** Given a group ID get a group object formed by aggregating polymer entities that share a degree of similarity */
|
||||
readonly polymer_entity_group?: Maybe<GroupPolymerEntity>;
|
||||
/** Given a list of group IDs get a list of group objects formed by aggregating polymer entities that share a degree of similarity */
|
||||
readonly polymer_entity_groups?: Maybe<ReadonlyArray<Maybe<GroupPolymerEntity>>>;
|
||||
/** Get a PDB polymer entity instance (chain), given the PDB ID and ENTITY INSTANCE ID. Here ENTITY INSTANCE ID identifies structural element in the asymmetric unit, e.g. 'A', 'B', etc. */
|
||||
readonly polymer_entity_instance?: Maybe<CorePolymerEntityInstance>;
|
||||
/** Get a list of PDB polymer entity instances (chains), given the list of ENTITY INSTANCE IDs. Here ENTITY INSTANCE ID identifies structural element in the asymmetric unit, e.g. 'A', 'B', etc. */
|
||||
@@ -6869,6 +6945,24 @@ export type QueryEntryArgs = {
|
||||
};
|
||||
|
||||
|
||||
/** Query root */
|
||||
export type QueryEntry_GroupArgs = {
|
||||
group_id: Scalars['String'];
|
||||
};
|
||||
|
||||
|
||||
/** Query root */
|
||||
export type QueryEntry_GroupsArgs = {
|
||||
group_ids: ReadonlyArray<InputMaybe<Scalars['String']>>;
|
||||
};
|
||||
|
||||
|
||||
/** Query root */
|
||||
export type QueryGroup_ProvenanceArgs = {
|
||||
group_provenance_id: Scalars['String'];
|
||||
};
|
||||
|
||||
|
||||
/** Query root */
|
||||
export type QueryInterfaceArgs = {
|
||||
assembly_id: Scalars['String'];
|
||||
@@ -6922,6 +7016,18 @@ export type QueryPolymer_EntityArgs = {
|
||||
};
|
||||
|
||||
|
||||
/** Query root */
|
||||
export type QueryPolymer_Entity_GroupArgs = {
|
||||
group_id: Scalars['String'];
|
||||
};
|
||||
|
||||
|
||||
/** Query root */
|
||||
export type QueryPolymer_Entity_GroupsArgs = {
|
||||
group_ids: ReadonlyArray<InputMaybe<Scalars['String']>>;
|
||||
};
|
||||
|
||||
|
||||
/** Query root */
|
||||
export type QueryPolymer_Entity_InstanceArgs = {
|
||||
asym_id: Scalars['String'];
|
||||
@@ -8666,6 +8772,25 @@ export type RcsbEntryContainerIdentifiers = {
|
||||
readonly water_entity_ids?: Maybe<ReadonlyArray<Maybe<Scalars['String']>>>;
|
||||
};
|
||||
|
||||
export type RcsbEntryGroupMembership = {
|
||||
/**
|
||||
* Method used to establish group membership
|
||||
*
|
||||
* Allowable values:
|
||||
* matching_deposit_group_id
|
||||
*
|
||||
*/
|
||||
readonly aggregation_method: Scalars['String'];
|
||||
/**
|
||||
* A unique identifier for a group of entries
|
||||
*
|
||||
* Examples:
|
||||
* G_1001001
|
||||
*
|
||||
*/
|
||||
readonly group_id: Scalars['String'];
|
||||
};
|
||||
|
||||
export type RcsbEntryInfo = {
|
||||
/** The number of assemblies defined for this entry including the deposited assembly. */
|
||||
readonly assembly_count?: Maybe<Scalars['Int']>;
|
||||
@@ -8893,6 +9018,127 @@ export type RcsbGenomicLineage = {
|
||||
readonly name?: Maybe<Scalars['String']>;
|
||||
};
|
||||
|
||||
export type RcsbGroupAccessionInfo = {
|
||||
/** Identifies the version of the groups solution */
|
||||
readonly version: Scalars['Int'];
|
||||
};
|
||||
|
||||
export type RcsbGroupAggregationMethod = {
|
||||
/** The details on a method used to calculate cluster solutions */
|
||||
readonly method: RcsbGroupAggregationMethodMethod;
|
||||
readonly similarity_criteria?: Maybe<RcsbGroupAggregationMethodSimilarityCriteria>;
|
||||
/**
|
||||
* Specifies the type of similarity criteria used to aggregate members into higher levels in the hierarchy
|
||||
*
|
||||
* Allowable values:
|
||||
* sequence_identity, matching_uniprot_accession, matching_deposit_group_id
|
||||
*
|
||||
*/
|
||||
readonly type: Scalars['String'];
|
||||
};
|
||||
|
||||
export type RcsbGroupAggregationMethodMethod = {
|
||||
/** Additional details describing the clustering process */
|
||||
readonly details?: Maybe<ReadonlyArray<Maybe<MethodDetails>>>;
|
||||
/**
|
||||
* The name of the software or the method used to calculate cluster solutions
|
||||
*
|
||||
* Allowable values:
|
||||
* mmseqs2, matching_reference_identity
|
||||
*
|
||||
*/
|
||||
readonly name: Scalars['String'];
|
||||
/**
|
||||
* The version of the software.
|
||||
*
|
||||
* Examples:
|
||||
* v1.0, 3.1-2, unknown
|
||||
*
|
||||
*/
|
||||
readonly version?: Maybe<Scalars['String']>;
|
||||
};
|
||||
|
||||
export type RcsbGroupAggregationMethodSimilarityCriteria = {
|
||||
/**
|
||||
* A function or similarity measure that quantifies the similarity between two members
|
||||
*
|
||||
* Allowable values:
|
||||
* rmsd, sequence_identity
|
||||
*
|
||||
*/
|
||||
readonly similarity_function?: Maybe<Scalars['String']>;
|
||||
};
|
||||
|
||||
export type RcsbGroupContainerIdentifiers = {
|
||||
/** A unique textual identifier for a group */
|
||||
readonly group_id: Scalars['String'];
|
||||
/** Member identifiers representing a group */
|
||||
readonly group_member_ids: ReadonlyArray<Maybe<Scalars['String']>>;
|
||||
/**
|
||||
* A unique group provenance identifier
|
||||
*
|
||||
* Allowable values:
|
||||
* provenance_sequence_identity, provenance_matching_uniprot_accession, provenance_matching_deposit_group_id
|
||||
*
|
||||
*/
|
||||
readonly group_provenance_id: Scalars['String'];
|
||||
/** Member identifiers representing a higher level in the groping hierarchy that has parent-child relationship */
|
||||
readonly parent_member_ids?: Maybe<ReadonlyArray<Maybe<Scalars['String']>>>;
|
||||
};
|
||||
|
||||
export type RcsbGroupInfo = {
|
||||
readonly group_description?: Maybe<Scalars['String']>;
|
||||
readonly group_members_count: Scalars['Int'];
|
||||
/**
|
||||
* Granularity of group members identifiers
|
||||
*
|
||||
* Allowable values:
|
||||
* assembly, entry, polymer_entity, polymer_entity_instance
|
||||
*
|
||||
*/
|
||||
readonly group_members_granularity: Scalars['String'];
|
||||
readonly group_name?: Maybe<Scalars['String']>;
|
||||
};
|
||||
|
||||
export type RcsbGroupProvenanceContainerIdentifiers = {
|
||||
/**
|
||||
* A unique group provenance identifier
|
||||
*
|
||||
* Allowable values:
|
||||
* provenance_sequence_identity, provenance_matching_uniprot_accession, provenance_matching_deposit_group_id
|
||||
*
|
||||
*/
|
||||
readonly group_provenance_id: Scalars['String'];
|
||||
};
|
||||
|
||||
export type RcsbGroupRelated = {
|
||||
/**
|
||||
* A unique code assigned to a reference related the group
|
||||
*
|
||||
* Examples:
|
||||
* P69905
|
||||
*
|
||||
*/
|
||||
readonly resource_accession_code?: Maybe<Scalars['String']>;
|
||||
/**
|
||||
* Defines the type of the resource describing related references
|
||||
*
|
||||
* Examples:
|
||||
* UniProt
|
||||
*
|
||||
*/
|
||||
readonly resource_name?: Maybe<Scalars['String']>;
|
||||
};
|
||||
|
||||
export type RcsbGroupStatistics = {
|
||||
/** The desired lower limit for the similarity between two members that belong to the same group */
|
||||
readonly similarity_cutoff?: Maybe<Scalars['Float']>;
|
||||
/** Similarity score between two most similar group members */
|
||||
readonly similarity_score_max?: Maybe<Scalars['Float']>;
|
||||
/** Similarity score between two least similar group members */
|
||||
readonly similarity_score_min?: Maybe<Scalars['Float']>;
|
||||
};
|
||||
|
||||
export type RcsbInterfaceContainerIdentifiers = {
|
||||
/** This item references an assembly in pdbx_struct_assembly */
|
||||
readonly assembly_id: Scalars['String'];
|
||||
@@ -9902,6 +10148,7 @@ export type RcsbPolymerEntity = {
|
||||
*
|
||||
*/
|
||||
readonly rcsb_multiple_source_flag?: Maybe<Scalars['String']>;
|
||||
readonly rcsb_polymer_name_combined?: Maybe<RcsbPolymerEntityRcsbPolymerNameCombined>;
|
||||
/**
|
||||
* The number of biological sources for the polymer entity. Multiple source contributions
|
||||
* may come from the same organism (taxonomy).
|
||||
@@ -10228,6 +10475,69 @@ export type RcsbPolymerEntityFeatureSummary = {
|
||||
readonly type?: Maybe<Scalars['String']>;
|
||||
};
|
||||
|
||||
export type RcsbPolymerEntityGroupMembersRankings = {
|
||||
readonly group_members: ReadonlyArray<Maybe<RcsbPolymerEntityGroupMembersRankingsGroupMembers>>;
|
||||
/**
|
||||
* Defines ranking option applicable to group members
|
||||
*
|
||||
* Allowable values:
|
||||
* coverage
|
||||
*
|
||||
*/
|
||||
readonly ranking_criteria_type: Scalars['String'];
|
||||
};
|
||||
|
||||
export type RcsbPolymerEntityGroupMembersRankingsGroupMembers = {
|
||||
readonly member_id: Scalars['String'];
|
||||
/** Quantifies the criteria used for ranking */
|
||||
readonly original_score?: Maybe<Scalars['Float']>;
|
||||
/** Reflects a relationship between group members such that, for any two members the first is ranked higher (smaller rank value) than the second */
|
||||
readonly rank: Scalars['Int'];
|
||||
};
|
||||
|
||||
export type RcsbPolymerEntityGroupMembership = {
|
||||
/**
|
||||
* Method used to establish group membership
|
||||
*
|
||||
* Allowable values:
|
||||
* sequence_identity, matching_uniprot_accession
|
||||
*
|
||||
*/
|
||||
readonly aggregation_method: Scalars['String'];
|
||||
/**
|
||||
* A unique identifier for a group of entities
|
||||
*
|
||||
* Examples:
|
||||
* 1_100, P00003
|
||||
*
|
||||
*/
|
||||
readonly group_id: Scalars['String'];
|
||||
/** Degree of similarity expressed as a floating-point number */
|
||||
readonly similarity_cutoff?: Maybe<Scalars['Float']>;
|
||||
};
|
||||
|
||||
export type RcsbPolymerEntityGroupSequenceAlignment = {
|
||||
/** Abstract reference where group members can be aligned to generate a MSA */
|
||||
readonly abstract_reference: RcsbPolymerEntityGroupSequenceAlignmentAbstractReference;
|
||||
/** List of alignments with core_entity canonical sequences */
|
||||
readonly group_members_alignment: ReadonlyArray<Maybe<RcsbPolymerEntityGroupSequenceAlignmentGroupMembersAlignment>>;
|
||||
};
|
||||
|
||||
export type RcsbPolymerEntityGroupSequenceAlignmentAbstractReference = {
|
||||
/** Abstract reference length */
|
||||
readonly length: Scalars['Int'];
|
||||
/** Sequence that represents the abstract reference */
|
||||
readonly sequence?: Maybe<Scalars['String']>;
|
||||
};
|
||||
|
||||
export type RcsbPolymerEntityGroupSequenceAlignmentGroupMembersAlignment = {
|
||||
/** Aligned region */
|
||||
readonly aligned_regions: ReadonlyArray<Maybe<GroupMembersAlignmentAlignedRegions>>;
|
||||
readonly member_id?: Maybe<Scalars['String']>;
|
||||
/** Alignment scores */
|
||||
readonly scores: GroupMembersAlignmentScores;
|
||||
};
|
||||
|
||||
export type RcsbPolymerEntityInstanceContainerIdentifiers = {
|
||||
/** Instance identifier for this container. */
|
||||
readonly asym_id: Scalars['String'];
|
||||
@@ -10346,6 +10656,13 @@ export type RcsbPolymerEntityRcsbMacromolecularNamesCombined = {
|
||||
readonly provenance_source?: Maybe<Scalars['String']>;
|
||||
};
|
||||
|
||||
export type RcsbPolymerEntityRcsbPolymerNameCombined = {
|
||||
/** Protein name annotated by the UniProtKB or macromolecular name assigned by the PDB */
|
||||
readonly names?: Maybe<ReadonlyArray<Maybe<Scalars['String']>>>;
|
||||
/** Allowable values: PDB Preferred Name, PDB Description, UniProt Name. */
|
||||
readonly provenance_source?: Maybe<Scalars['String']>;
|
||||
};
|
||||
|
||||
export type RcsbPolymerInstanceAnnotation = {
|
||||
/** An identifier for the annotation. */
|
||||
readonly annotation_id?: Maybe<Scalars['String']>;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2018-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
* @author David Sehnal <david.sehnal@gmail.com>
|
||||
@@ -372,12 +372,12 @@ namespace Canvas3D {
|
||||
const { repr, loci } = reprLoci;
|
||||
let changed = false;
|
||||
if (repr) {
|
||||
changed = repr.mark(loci, action);
|
||||
changed = repr.mark(loci, action) || changed;
|
||||
} else {
|
||||
changed = helper.handle.mark(loci, action);
|
||||
changed = helper.camera.mark(loci, action) || changed;
|
||||
reprRenderObjects.forEach((_, _repr) => { changed = _repr.mark(loci, action) || changed; });
|
||||
}
|
||||
changed = helper.handle.mark(loci, action) || changed;
|
||||
changed = helper.camera.mark(loci, action) || changed;
|
||||
return changed;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2020-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2020-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
*/
|
||||
@@ -17,7 +17,7 @@ import { WebGLContext } from '../../mol-gl/webgl/context';
|
||||
import { GraphicsRenderVariantsBlended } from '../../mol-gl/webgl/render-item';
|
||||
import { Sphere3D } from '../../mol-math/geometry';
|
||||
import { Mat4, Vec3 } from '../../mol-math/linear-algebra';
|
||||
import { DataLoci, EmptyLoci, Loci } from '../../mol-model/loci';
|
||||
import { DataLoci, EmptyLoci, isEveryLoci, Loci } from '../../mol-model/loci';
|
||||
import { Shape } from '../../mol-model/shape';
|
||||
import { Visual } from '../../mol-repr/visual';
|
||||
import { ColorNames } from '../../mol-util/color/names';
|
||||
@@ -113,8 +113,10 @@ export class CameraHelper {
|
||||
|
||||
mark(loci: Loci, action: MarkerAction) {
|
||||
if (!MarkerActions.is(MarkerActions.Highlighting, action)) return false;
|
||||
if (!isCameraAxesLoci(loci)) return false;
|
||||
if (loci.data !== this) return false;
|
||||
if (!isEveryLoci(loci)) {
|
||||
if (!isCameraAxesLoci(loci)) return false;
|
||||
if (loci.data !== this) return false;
|
||||
}
|
||||
return Visual.mark(this.renderObject, loci, action, this.eachGroup);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2020-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
*/
|
||||
@@ -20,7 +20,7 @@ import produce from 'immer';
|
||||
import { Shape } from '../../mol-model/shape';
|
||||
import { PickingId } from '../../mol-geo/geometry/picking';
|
||||
import { Camera } from '../camera';
|
||||
import { DataLoci, EmptyLoci, Loci } from '../../mol-model/loci';
|
||||
import { DataLoci, EmptyLoci, isEveryLoci, Loci } from '../../mol-model/loci';
|
||||
import { MarkerAction, MarkerActions } from '../../mol-util/marker-action';
|
||||
import { Visual } from '../../mol-repr/visual';
|
||||
import { Interval } from '../../mol-data/int';
|
||||
@@ -121,8 +121,10 @@ export class HandleHelper {
|
||||
|
||||
mark(loci: Loci, action: MarkerAction) {
|
||||
if (!MarkerActions.is(MarkerActions.Highlighting, action)) return false;
|
||||
if (!isHandleLoci(loci)) return false;
|
||||
if (loci.data !== this) return false;
|
||||
if (!isEveryLoci(loci)) {
|
||||
if (!isHandleLoci(loci)) return false;
|
||||
if (loci.data !== this) return false;
|
||||
}
|
||||
return Visual.mark(this.renderObject, loci, action, this.eachGroup);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,48 +11,16 @@ import { Renderer } from '../../mol-gl/renderer';
|
||||
import { Scene } from '../../mol-gl/scene';
|
||||
import { Texture } from '../../mol-gl/webgl/texture';
|
||||
import { Camera, ICamera } from '../camera';
|
||||
import { QuadSchema, QuadValues } from '../../mol-gl/compute/util';
|
||||
import { DefineSpec, TextureSpec, UniformSpec, Values } from '../../mol-gl/renderable/schema';
|
||||
import { ComputeRenderable, createComputeRenderable } from '../../mol-gl/renderable';
|
||||
import { ShaderCode } from '../../mol-gl/shader-code';
|
||||
import { createComputeRenderItem } from '../../mol-gl/webgl/render-item';
|
||||
import { ValueCell } from '../../mol-util';
|
||||
import { Vec2 } from '../../mol-math/linear-algebra';
|
||||
import { Helper } from '../helper/helper';
|
||||
|
||||
import { quad_vert } from '../../mol-gl/shader/quad.vert';
|
||||
import { depthMerge_frag } from '../../mol-gl/shader/depth-merge.frag';
|
||||
import { StereoCamera } from '../camera/stereo';
|
||||
import { WboitPass } from './wboit';
|
||||
import { AntialiasingPass, PostprocessingPass, PostprocessingProps } from './postprocessing';
|
||||
import { MarkingPass, MarkingProps } from './marking';
|
||||
import { CopyRenderable, createCopyRenderable } from '../../mol-gl/compute/util';
|
||||
|
||||
const DepthMergeSchema = {
|
||||
...QuadSchema,
|
||||
tDepthPrimitives: TextureSpec('texture', 'depth', 'ushort', 'nearest'),
|
||||
tDepthVolumes: TextureSpec('texture', 'depth', 'ushort', 'nearest'),
|
||||
uTexSize: UniformSpec('v2'),
|
||||
dPackedDepth: DefineSpec('boolean'),
|
||||
};
|
||||
const DepthMergeShaderCode = ShaderCode('depth-merge', quad_vert, depthMerge_frag);
|
||||
type DepthMergeRenderable = ComputeRenderable<Values<typeof DepthMergeSchema>>
|
||||
|
||||
function getDepthMergeRenderable(ctx: WebGLContext, depthTexturePrimitives: Texture, depthTextureVolumes: Texture, packedDepth: boolean): DepthMergeRenderable {
|
||||
const values: Values<typeof DepthMergeSchema> = {
|
||||
...QuadValues,
|
||||
tDepthPrimitives: ValueCell.create(depthTexturePrimitives),
|
||||
tDepthVolumes: ValueCell.create(depthTextureVolumes),
|
||||
uTexSize: ValueCell.create(Vec2.create(depthTexturePrimitives.getWidth(), depthTexturePrimitives.getHeight())),
|
||||
dPackedDepth: ValueCell.create(packedDepth),
|
||||
};
|
||||
|
||||
const schema = { ...DepthMergeSchema };
|
||||
const renderItem = createComputeRenderItem(ctx, 'triangles', DepthMergeShaderCode, schema, values);
|
||||
|
||||
return createComputeRenderable(renderItem, values);
|
||||
}
|
||||
|
||||
type Props = {
|
||||
postprocessing: PostprocessingProps
|
||||
marking: MarkingProps
|
||||
@@ -70,16 +38,13 @@ export class DrawPass {
|
||||
private readonly drawTarget: RenderTarget;
|
||||
|
||||
readonly colorTarget: RenderTarget;
|
||||
readonly depthTexture: Texture;
|
||||
readonly depthTexturePrimitives: Texture;
|
||||
readonly depthTextureTransparent: Texture;
|
||||
readonly depthTextureOpaque: Texture;
|
||||
|
||||
readonly packedDepth: boolean;
|
||||
|
||||
private depthTarget: RenderTarget;
|
||||
private depthTargetPrimitives: RenderTarget | null;
|
||||
private depthTargetVolumes: RenderTarget | null;
|
||||
private depthTextureVolumes: Texture;
|
||||
private depthMerge: DepthMergeRenderable;
|
||||
private depthTargetTransparent: RenderTarget;
|
||||
private depthTargetOpaque: RenderTarget | null;
|
||||
|
||||
private copyFboTarget: CopyRenderable;
|
||||
private copyFboPostprocessing: CopyRenderable;
|
||||
@@ -101,19 +66,15 @@ export class DrawPass {
|
||||
this.colorTarget = webgl.createRenderTarget(width, height, true, 'uint8', 'linear');
|
||||
this.packedDepth = !extensions.depthTexture;
|
||||
|
||||
this.depthTarget = webgl.createRenderTarget(width, height);
|
||||
this.depthTexture = this.depthTarget.texture;
|
||||
this.depthTargetTransparent = webgl.createRenderTarget(width, height);
|
||||
this.depthTextureTransparent = this.depthTargetTransparent.texture;
|
||||
|
||||
this.depthTargetPrimitives = this.packedDepth ? webgl.createRenderTarget(width, height) : null;
|
||||
this.depthTargetVolumes = this.packedDepth ? webgl.createRenderTarget(width, height) : null;
|
||||
this.depthTargetOpaque = this.packedDepth ? webgl.createRenderTarget(width, height) : null;
|
||||
|
||||
this.depthTexturePrimitives = this.depthTargetPrimitives ? this.depthTargetPrimitives.texture : resources.texture('image-depth', 'depth', isWebGL2 ? 'float' : 'ushort', 'nearest');
|
||||
this.depthTextureVolumes = this.depthTargetVolumes ? this.depthTargetVolumes.texture : resources.texture('image-depth', 'depth', isWebGL2 ? 'float' : 'ushort', 'nearest');
|
||||
this.depthTextureOpaque = this.depthTargetOpaque ? this.depthTargetOpaque.texture : resources.texture('image-depth', 'depth', isWebGL2 ? 'float' : 'ushort', 'nearest');
|
||||
if (!this.packedDepth) {
|
||||
this.depthTexturePrimitives.define(width, height);
|
||||
this.depthTextureVolumes.define(width, height);
|
||||
this.depthTextureOpaque.define(width, height);
|
||||
}
|
||||
this.depthMerge = getDepthMergeRenderable(webgl, this.depthTexturePrimitives, this.depthTextureVolumes, this.packedDepth);
|
||||
|
||||
this.wboit = enableWboit ? new WboitPass(webgl, width, height) : undefined;
|
||||
this.marking = new MarkingPass(webgl, width, height);
|
||||
@@ -134,22 +95,14 @@ export class DrawPass {
|
||||
|
||||
if (width !== w || height !== h) {
|
||||
this.colorTarget.setSize(width, height);
|
||||
this.depthTarget.setSize(width, height);
|
||||
this.depthTargetTransparent.setSize(width, height);
|
||||
|
||||
if (this.depthTargetPrimitives) {
|
||||
this.depthTargetPrimitives.setSize(width, height);
|
||||
if (this.depthTargetOpaque) {
|
||||
this.depthTargetOpaque.setSize(width, height);
|
||||
} else {
|
||||
this.depthTexturePrimitives.define(width, height);
|
||||
this.depthTextureOpaque.define(width, height);
|
||||
}
|
||||
|
||||
if (this.depthTargetVolumes) {
|
||||
this.depthTargetVolumes.setSize(width, height);
|
||||
} else {
|
||||
this.depthTextureVolumes.define(width, height);
|
||||
}
|
||||
|
||||
ValueCell.update(this.depthMerge.values.uTexSize, Vec2.set(this.depthMerge.values.uTexSize.ref.value, width, height));
|
||||
|
||||
ValueCell.update(this.copyFboTarget.values.uTexSize, Vec2.set(this.copyFboTarget.values.uTexSize.ref.value, width, height));
|
||||
ValueCell.update(this.copyFboPostprocessing.values.uTexSize, Vec2.set(this.copyFboPostprocessing.values.uTexSize.ref.value, width, height));
|
||||
|
||||
@@ -163,20 +116,6 @@ export class DrawPass {
|
||||
}
|
||||
}
|
||||
|
||||
private _depthMerge() {
|
||||
const { state, gl } = this.webgl;
|
||||
|
||||
this.depthMerge.update();
|
||||
this.depthTarget.bind();
|
||||
state.disable(gl.BLEND);
|
||||
state.disable(gl.DEPTH_TEST);
|
||||
state.disable(gl.CULL_FACE);
|
||||
state.depthMask(false);
|
||||
state.clearColor(1, 1, 1, 1);
|
||||
gl.clear(gl.COLOR_BUFFER_BIT);
|
||||
this.depthMerge.render();
|
||||
}
|
||||
|
||||
private _renderWboit(renderer: Renderer, camera: ICamera, scene: Scene, transparentBackground: boolean, postprocessingProps: PostprocessingProps) {
|
||||
if (!this.wboit?.supported) throw new Error('expected wboit to be supported');
|
||||
|
||||
@@ -184,38 +123,37 @@ export class DrawPass {
|
||||
renderer.clear(true);
|
||||
|
||||
// render opaque primitives
|
||||
this.depthTexturePrimitives.attachFramebuffer(this.colorTarget.framebuffer, 'depth');
|
||||
this.depthTextureOpaque.attachFramebuffer(this.colorTarget.framebuffer, 'depth');
|
||||
this.colorTarget.bind();
|
||||
renderer.clearDepth();
|
||||
renderer.renderWboitOpaque(scene.primitives, camera, null);
|
||||
|
||||
// render opaque volumes
|
||||
this.depthTextureVolumes.attachFramebuffer(this.colorTarget.framebuffer, 'depth');
|
||||
this.colorTarget.bind();
|
||||
renderer.clearDepth();
|
||||
renderer.renderWboitOpaque(scene.volumes, camera, this.depthTexturePrimitives);
|
||||
|
||||
// merge depth of opaque primitives and volumes
|
||||
this._depthMerge();
|
||||
|
||||
if (PostprocessingPass.isEnabled(postprocessingProps)) {
|
||||
if (PostprocessingPass.isOutlineEnabled(postprocessingProps)) {
|
||||
this.depthTargetTransparent.bind();
|
||||
renderer.clearDepth(true);
|
||||
if (scene.opacityAverage < 1) {
|
||||
renderer.renderDepthTransparent(scene.primitives, camera, this.depthTextureOpaque);
|
||||
}
|
||||
}
|
||||
|
||||
this.postprocessing.render(camera, false, transparentBackground, renderer.props.backgroundColor, postprocessingProps);
|
||||
}
|
||||
|
||||
// render transparent primitives and volumes
|
||||
this.wboit.bind();
|
||||
renderer.renderWboitTransparent(scene.primitives, camera, this.depthTexture);
|
||||
renderer.renderWboitTransparent(scene.volumes, camera, this.depthTexture);
|
||||
if (scene.opacityAverage < 1 || scene.volumes.renderables.length > 0) {
|
||||
this.wboit.bind();
|
||||
renderer.renderWboitTransparent(scene.primitives, camera, this.depthTextureOpaque);
|
||||
renderer.renderWboitTransparent(scene.volumes, camera, this.depthTextureOpaque);
|
||||
|
||||
// evaluate wboit
|
||||
if (PostprocessingPass.isEnabled(postprocessingProps)) {
|
||||
this.depthTexturePrimitives.attachFramebuffer(this.postprocessing.target.framebuffer, 'depth');
|
||||
this.postprocessing.target.bind();
|
||||
} else {
|
||||
this.depthTexturePrimitives.attachFramebuffer(this.colorTarget.framebuffer, 'depth');
|
||||
this.colorTarget.bind();
|
||||
// evaluate wboit
|
||||
if (PostprocessingPass.isEnabled(postprocessingProps)) {
|
||||
this.postprocessing.target.bind();
|
||||
} else {
|
||||
this.colorTarget.bind();
|
||||
}
|
||||
this.wboit.render();
|
||||
}
|
||||
this.wboit.render();
|
||||
}
|
||||
|
||||
private _renderBlended(renderer: Renderer, camera: ICamera, scene: Scene, toDrawingBuffer: boolean, transparentBackground: boolean, postprocessingProps: PostprocessingProps) {
|
||||
@@ -224,7 +162,7 @@ export class DrawPass {
|
||||
} else {
|
||||
this.colorTarget.bind();
|
||||
if (!this.packedDepth) {
|
||||
this.depthTexturePrimitives.attachFramebuffer(this.colorTarget.framebuffer, 'depth');
|
||||
this.depthTextureOpaque.attachFramebuffer(this.colorTarget.framebuffer, 'depth');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,44 +172,38 @@ export class DrawPass {
|
||||
if (!toDrawingBuffer) {
|
||||
// do a depth pass if not rendering to drawing buffer and
|
||||
// extensions.depthTexture is unsupported (i.e. depthTarget is set)
|
||||
if (this.depthTargetPrimitives) {
|
||||
this.depthTargetPrimitives.bind();
|
||||
renderer.clear(false);
|
||||
// TODO: this should only render opaque
|
||||
renderer.renderDepth(scene.primitives, camera, null);
|
||||
if (this.depthTargetOpaque) {
|
||||
this.depthTargetOpaque.bind();
|
||||
renderer.clearDepth(true);
|
||||
renderer.renderDepthOpaque(scene.primitives, camera, null);
|
||||
this.colorTarget.bind();
|
||||
}
|
||||
|
||||
// do direct-volume rendering
|
||||
if (!this.packedDepth) {
|
||||
this.depthTextureVolumes.attachFramebuffer(this.colorTarget.framebuffer, 'depth');
|
||||
renderer.clearDepth(); // from previous frame
|
||||
}
|
||||
renderer.renderBlendedVolumeOpaque(scene.volumes, camera, this.depthTexturePrimitives);
|
||||
|
||||
// do volume depth pass if extensions.depthTexture is unsupported (i.e. depthTarget is set)
|
||||
if (this.depthTargetVolumes) {
|
||||
this.depthTargetVolumes.bind();
|
||||
renderer.clear(false);
|
||||
renderer.renderDepth(scene.volumes, camera, this.depthTexturePrimitives);
|
||||
this.colorTarget.bind();
|
||||
}
|
||||
|
||||
// merge depths from primitive and volume rendering
|
||||
this._depthMerge();
|
||||
this.colorTarget.bind();
|
||||
|
||||
if (PostprocessingPass.isEnabled(postprocessingProps)) {
|
||||
this.postprocessing.render(camera, false, transparentBackground, renderer.props.backgroundColor, postprocessingProps);
|
||||
}
|
||||
renderer.renderBlendedVolumeTransparent(scene.volumes, camera, this.depthTexturePrimitives);
|
||||
if (!this.packedDepth) {
|
||||
this.depthTextureOpaque.detachFramebuffer(this.postprocessing.target.framebuffer, 'depth');
|
||||
} else {
|
||||
this.colorTarget.depthRenderbuffer?.detachFramebuffer(this.postprocessing.target.framebuffer);
|
||||
}
|
||||
|
||||
const target = PostprocessingPass.isEnabled(postprocessingProps)
|
||||
? this.postprocessing.target : this.colorTarget;
|
||||
if (!this.packedDepth) {
|
||||
this.depthTexturePrimitives.attachFramebuffer(target.framebuffer, 'depth');
|
||||
if (PostprocessingPass.isOutlineEnabled(postprocessingProps)) {
|
||||
this.depthTargetTransparent.bind();
|
||||
renderer.clearDepth(true);
|
||||
if (scene.opacityAverage < 1) {
|
||||
renderer.renderDepthTransparent(scene.primitives, camera, this.depthTextureOpaque);
|
||||
}
|
||||
}
|
||||
|
||||
this.postprocessing.render(camera, false, transparentBackground, renderer.props.backgroundColor, postprocessingProps);
|
||||
|
||||
if (!this.packedDepth) {
|
||||
this.depthTextureOpaque.attachFramebuffer(this.postprocessing.target.framebuffer, 'depth');
|
||||
} else {
|
||||
this.colorTarget.depthRenderbuffer?.attachFramebuffer(this.postprocessing.target.framebuffer);
|
||||
}
|
||||
}
|
||||
target.bind();
|
||||
|
||||
renderer.renderBlendedVolume(scene.volumes, camera, this.depthTextureOpaque);
|
||||
}
|
||||
|
||||
renderer.renderBlendedTransparent(scene.primitives, camera, null);
|
||||
@@ -307,10 +239,9 @@ export class DrawPass {
|
||||
}
|
||||
|
||||
if (markingEnabled) {
|
||||
const markerAverage = scene.getMarkerAverage();
|
||||
if (markerAverage > 0) {
|
||||
if (scene.markerAverage > 0) {
|
||||
const markingDepthTest = props.marking.ghostEdgeStrength < 1;
|
||||
if (markingDepthTest && markerAverage !== 1) {
|
||||
if (markingDepthTest && scene.markerAverage !== 1) {
|
||||
this.marking.depthTarget.bind();
|
||||
renderer.clear(false, true);
|
||||
renderer.renderMarkingDepth(scene.primitives, camera, null);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2019-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2019-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
*/
|
||||
@@ -8,7 +8,6 @@ import { PickingId } from '../../mol-geo/geometry/picking';
|
||||
import { PickType, Renderer } from '../../mol-gl/renderer';
|
||||
import { Scene } from '../../mol-gl/scene';
|
||||
import { WebGLContext } from '../../mol-gl/webgl/context';
|
||||
import { GraphicsRenderVariant } from '../../mol-gl/webgl/render-item';
|
||||
import { RenderTarget } from '../../mol-gl/webgl/render-target';
|
||||
import { Vec3 } from '../../mol-math/linear-algebra';
|
||||
import { spiral2d } from '../../mol-math/misc';
|
||||
@@ -64,13 +63,11 @@ export class PickPass {
|
||||
}
|
||||
}
|
||||
|
||||
private renderVariant(renderer: Renderer, camera: ICamera, scene: Scene, helper: Helper, variant: GraphicsRenderVariant, pickType: number) {
|
||||
const depth = this.drawPass.depthTexturePrimitives;
|
||||
private renderVariant(renderer: Renderer, camera: ICamera, scene: Scene, helper: Helper, variant: 'pick' | 'depth', pickType: number) {
|
||||
renderer.clear(false);
|
||||
|
||||
renderer.update(camera);
|
||||
renderer.renderPick(scene.primitives, camera, variant, null, pickType);
|
||||
renderer.renderPick(scene.volumes, camera, variant, depth, pickType);
|
||||
renderer.renderPick(helper.handle.scene, camera, variant, null, pickType);
|
||||
|
||||
if (helper.camera.isEnabled) {
|
||||
|
||||
@@ -30,7 +30,8 @@ import { SmaaParams, SmaaPass } from './smaa';
|
||||
|
||||
const OutlinesSchema = {
|
||||
...QuadSchema,
|
||||
tDepth: TextureSpec('texture', 'rgba', 'ubyte', 'nearest'),
|
||||
tDepthOpaque: TextureSpec('texture', 'rgba', 'ubyte', 'nearest'),
|
||||
tDepthTransparent: TextureSpec('texture', 'rgba', 'ubyte', 'nearest'),
|
||||
uTexSize: UniformSpec('v2'),
|
||||
|
||||
dOrthographic: DefineSpec('number'),
|
||||
@@ -41,11 +42,15 @@ const OutlinesSchema = {
|
||||
};
|
||||
type OutlinesRenderable = ComputeRenderable<Values<typeof OutlinesSchema>>
|
||||
|
||||
function getOutlinesRenderable(ctx: WebGLContext, depthTexture: Texture): OutlinesRenderable {
|
||||
function getOutlinesRenderable(ctx: WebGLContext, depthTextureOpaque: Texture, depthTextureTransparent: Texture): OutlinesRenderable {
|
||||
const width = depthTextureOpaque.getWidth();
|
||||
const height = depthTextureOpaque.getHeight();
|
||||
|
||||
const values: Values<typeof OutlinesSchema> = {
|
||||
...QuadValues,
|
||||
tDepth: ValueCell.create(depthTexture),
|
||||
uTexSize: ValueCell.create(Vec2.create(depthTexture.getWidth(), depthTexture.getHeight())),
|
||||
tDepthOpaque: ValueCell.create(depthTextureOpaque),
|
||||
tDepthTransparent: ValueCell.create(depthTextureTransparent),
|
||||
uTexSize: ValueCell.create(Vec2.create(width, height)),
|
||||
|
||||
dOrthographic: ValueCell.create(0),
|
||||
uNear: ValueCell.create(1),
|
||||
@@ -183,7 +188,8 @@ const PostprocessingSchema = {
|
||||
...QuadSchema,
|
||||
tSsaoDepth: TextureSpec('texture', 'rgba', 'ubyte', 'nearest'),
|
||||
tColor: TextureSpec('texture', 'rgba', 'ubyte', 'nearest'),
|
||||
tDepth: TextureSpec('texture', 'rgba', 'ubyte', 'nearest'),
|
||||
tDepthOpaque: TextureSpec('texture', 'rgba', 'ubyte', 'nearest'),
|
||||
tDepthTransparent: TextureSpec('texture', 'rgba', 'ubyte', 'nearest'),
|
||||
tOutlines: TextureSpec('texture', 'rgba', 'ubyte', 'nearest'),
|
||||
uTexSize: UniformSpec('v2'),
|
||||
|
||||
@@ -207,12 +213,13 @@ const PostprocessingSchema = {
|
||||
};
|
||||
type PostprocessingRenderable = ComputeRenderable<Values<typeof PostprocessingSchema>>
|
||||
|
||||
function getPostprocessingRenderable(ctx: WebGLContext, colorTexture: Texture, depthTexture: Texture, outlinesTexture: Texture, ssaoDepthTexture: Texture): PostprocessingRenderable {
|
||||
function getPostprocessingRenderable(ctx: WebGLContext, colorTexture: Texture, depthTextureOpaque: Texture, depthTextureTransparent: Texture, outlinesTexture: Texture, ssaoDepthTexture: Texture): PostprocessingRenderable {
|
||||
const values: Values<typeof PostprocessingSchema> = {
|
||||
...QuadValues,
|
||||
tSsaoDepth: ValueCell.create(ssaoDepthTexture),
|
||||
tColor: ValueCell.create(colorTexture),
|
||||
tDepth: ValueCell.create(depthTexture),
|
||||
tDepthOpaque: ValueCell.create(depthTextureOpaque),
|
||||
tDepthTransparent: ValueCell.create(depthTextureTransparent),
|
||||
tOutlines: ValueCell.create(outlinesTexture),
|
||||
uTexSize: ValueCell.create(Vec2.create(colorTexture.getWidth(), colorTexture.getHeight())),
|
||||
|
||||
@@ -274,6 +281,10 @@ export class PostprocessingPass {
|
||||
return props.occlusion.name === 'on' || props.outline.name === 'on';
|
||||
}
|
||||
|
||||
static isOutlineEnabled(props: PostprocessingProps) {
|
||||
return props.outline.name === 'on';
|
||||
}
|
||||
|
||||
readonly target: RenderTarget;
|
||||
|
||||
private readonly outlinesTarget: RenderTarget;
|
||||
@@ -307,7 +318,7 @@ export class PostprocessingPass {
|
||||
}
|
||||
|
||||
constructor(private webgl: WebGLContext, private drawPass: DrawPass) {
|
||||
const { colorTarget, depthTexture } = drawPass;
|
||||
const { colorTarget, depthTextureTransparent, depthTextureOpaque } = drawPass;
|
||||
const width = colorTarget.getWidth();
|
||||
const height = colorTarget.getHeight();
|
||||
|
||||
@@ -320,7 +331,7 @@ export class PostprocessingPass {
|
||||
this.target = webgl.createRenderTarget(width, height, false, 'uint8', 'linear');
|
||||
|
||||
this.outlinesTarget = webgl.createRenderTarget(width, height, false);
|
||||
this.outlinesRenderable = getOutlinesRenderable(webgl, depthTexture);
|
||||
this.outlinesRenderable = getOutlinesRenderable(webgl, depthTextureOpaque, depthTextureTransparent);
|
||||
|
||||
this.randomHemisphereVector = [];
|
||||
for (let i = 0; i < 256; i++) {
|
||||
@@ -340,7 +351,7 @@ export class PostprocessingPass {
|
||||
const sh = Math.floor(height * this.ssaoScale);
|
||||
|
||||
this.downsampledDepthTarget = webgl.createRenderTarget(sw, sh, false, 'uint8', 'linear');
|
||||
this.downsampleDepthRenderable = createCopyRenderable(webgl, depthTexture);
|
||||
this.downsampleDepthRenderable = createCopyRenderable(webgl, depthTextureOpaque);
|
||||
|
||||
this.ssaoDepthTexture = webgl.resources.texture('image-uint8', 'rgba', 'ubyte', 'linear');
|
||||
this.ssaoDepthTexture.define(sw, sh);
|
||||
@@ -352,10 +363,10 @@ export class PostprocessingPass {
|
||||
|
||||
this.ssaoDepthTexture.attachFramebuffer(this.ssaoBlurSecondPassFramebuffer, 'color0');
|
||||
|
||||
this.ssaoRenderable = getSsaoRenderable(webgl, this.downsampleFactor === 1 ? depthTexture : this.downsampledDepthTarget.texture);
|
||||
this.ssaoRenderable = getSsaoRenderable(webgl, this.downsampleFactor === 1 ? depthTextureOpaque : this.downsampledDepthTarget.texture);
|
||||
this.ssaoBlurFirstPassRenderable = getSsaoBlurRenderable(webgl, this.ssaoDepthTexture, 'horizontal');
|
||||
this.ssaoBlurSecondPassRenderable = getSsaoBlurRenderable(webgl, this.ssaoDepthBlurProxyTexture, 'vertical');
|
||||
this.renderable = getPostprocessingRenderable(webgl, colorTarget.texture, depthTexture, this.outlinesTarget.texture, this.ssaoDepthTexture);
|
||||
this.renderable = getPostprocessingRenderable(webgl, colorTarget.texture, depthTextureOpaque, depthTextureTransparent, this.outlinesTarget.texture, this.ssaoDepthTexture);
|
||||
}
|
||||
|
||||
setSize(width: number, height: number) {
|
||||
@@ -460,7 +471,7 @@ export class PostprocessingPass {
|
||||
this.ssaoDepthBlurProxyTexture.define(sw, sh);
|
||||
|
||||
if (this.ssaoScale === 1) {
|
||||
ValueCell.update(this.ssaoRenderable.values.tDepth, this.drawPass.depthTexture);
|
||||
ValueCell.update(this.ssaoRenderable.values.tDepth, this.drawPass.depthTextureTransparent);
|
||||
} else {
|
||||
ValueCell.update(this.ssaoRenderable.values.tDepth, this.downsampledDepthTarget.texture);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2017-2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2017-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* @author David Sehnal <david.sehnal@gmail.com>
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
@@ -61,6 +61,29 @@ describe('column', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('string column', () => {
|
||||
const xs = ['A', 'b', null, undefined];
|
||||
const xsArr = xs.map(x => x ?? '');
|
||||
const xsLC = xs.map(x => (x ?? '').toLowerCase());
|
||||
const arr = Column.ofArray({ array: xs as any, schema: Column.Schema.str });
|
||||
const arrLC = Column.ofArray({ array: xs as any, schema: Column.Schema.Str({ transform: 'lowercase' }) });
|
||||
const aliasedLC = Column.ofArray({ array: xs as any, schema: Column.Schema.Aliased<'a' | 'b'>(Column.Schema.lstr) });
|
||||
|
||||
it('value', () => {
|
||||
for (let i = 0; i < xs.length; i++) {
|
||||
expect(arr.value(i)).toBe(xs[i] ?? '');
|
||||
expect(arrLC.value(i)).toBe(xsLC[i] ?? '');
|
||||
expect(aliasedLC.value(i)).toBe(xsLC[i]);
|
||||
}
|
||||
});
|
||||
|
||||
it('array', () => {
|
||||
expect(arr.toArray()).toEqual(xsArr);
|
||||
expect(arrLC.toArray()).toEqual(xsLC);
|
||||
expect(aliasedLC.toArray()).toEqual(xsLC);
|
||||
});
|
||||
});
|
||||
|
||||
describe('table', () => {
|
||||
const schema = {
|
||||
x: Column.Schema.int,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2017-2019 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2017-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* @author David Sehnal <david.sehnal@gmail.com>
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
@@ -25,38 +25,39 @@ interface Column<T> {
|
||||
namespace Column {
|
||||
export type ArrayCtor<T> = { new(size: number): ArrayLike<T> }
|
||||
|
||||
export type Schema<T = any> = Schema.Str | Schema.Int | Schema.Float | Schema.Coordinate | Schema.Aliased<T> | Schema.Tensor | Schema.List<number|string>
|
||||
export type Schema<T = any> = Schema.Str | Schema.Int | Schema.Float | Schema.Coordinate | Schema.Aliased<T> | Schema.Tensor | Schema.List<number | string>
|
||||
|
||||
export namespace Schema {
|
||||
// T also serves as a default value for undefined columns
|
||||
|
||||
type Base<T extends string> = { valueType: T }
|
||||
export type Str = { '@type': 'str', T: string } & Base<'str'>
|
||||
export type Str = { '@type': 'str', T: string, transform?: 'uppercase' | 'lowercase' } & Base<'str'>
|
||||
export type Int = { '@type': 'int', T: number } & Base<'int'>
|
||||
export type Float = { '@type': 'float', T: number } & Base<'float'>
|
||||
export type Coordinate = { '@type': 'coord', T: number } & Base<'float'>
|
||||
|
||||
export type Tensor = { '@type': 'tensor', T: Tensors.Data, space: Tensors.Space, baseType: Int | Float } & Base<'tensor'>
|
||||
export type Aliased<T> = { '@type': 'aliased', T: T } & Base<T extends string ? 'str' : 'int'>
|
||||
export type List<T extends number|string> = { '@type': 'list', T: T[], separator: string, itemParse: (x: string) => T } & Base<'list'>
|
||||
export type Aliased<T> = { '@type': 'aliased', T: T, transform?: T extends string ? 'uppercase' | 'lowercase' : never } & Base<T extends string ? 'str' : 'int'>
|
||||
export type List<T extends number | string> = { '@type': 'list', T: T[], separator: string, itemParse: (x: string) => T } & Base<'list'>
|
||||
|
||||
export const str: Str = { '@type': 'str', T: '', valueType: 'str' };
|
||||
export const ustr: Str = { '@type': 'str', T: '', valueType: 'str', transform: 'uppercase' };
|
||||
export const lstr: Str = { '@type': 'str', T: '', valueType: 'str', transform: 'lowercase' };
|
||||
export const int: Int = { '@type': 'int', T: 0, valueType: 'int' };
|
||||
export const coord: Coordinate = { '@type': 'coord', T: 0, valueType: 'float' };
|
||||
export const float: Float = { '@type': 'float', T: 0, valueType: 'float' };
|
||||
|
||||
export function Str(defaultValue = ''): Str { return { '@type': 'str', T: defaultValue, valueType: 'str' }; };
|
||||
export function Str(options?: { defaultValue?: string, transform?: 'uppercase' | 'lowercase' }): Str { return { '@type': 'str', T: options?.defaultValue ?? '', transform: options?.transform, valueType: 'str' }; };
|
||||
export function Int(defaultValue = 0): Int { return { '@type': 'int', T: defaultValue, valueType: 'int' }; };
|
||||
export function Float(defaultValue = 0): Float { return { '@type': 'float', T: defaultValue, valueType: 'float' }; };
|
||||
export function Tensor(space: Tensors.Space, baseType: Int | Float = float): Tensor { return { '@type': 'tensor', T: space.create(), space, valueType: 'tensor', baseType }; }
|
||||
export function Vector(dim: number, baseType: Int | Float = float): Tensor { return Tensor(Tensors.Vector(dim, baseType['@type'] === 'int' ? Int32Array : Float64Array), baseType); }
|
||||
export function Matrix(rows: number, cols: number, baseType: Int | Float = float): Tensor { return Tensor(Tensors.ColumnMajorMatrix(rows, cols, baseType['@type'] === 'int' ? Int32Array : Float64Array), baseType); }
|
||||
|
||||
export function Aliased<T>(t: Str | Int, defaultValue?: T): Aliased<T> {
|
||||
if (typeof defaultValue !== 'undefined') return { ...t, T: defaultValue } as any as Aliased<T>;
|
||||
export function Aliased<T>(t: Str | Int): Aliased<T> {
|
||||
return t as any as Aliased<T>;
|
||||
}
|
||||
export function List<T extends number|string>(separator: string, itemParse: (x: string) => T, defaultValue: T[] = []): List<T> {
|
||||
export function List<T extends number | string>(separator: string, itemParse: (x: string) => T, defaultValue: T[] = []): List<T> {
|
||||
return { '@type': 'list', T: defaultValue, separator, itemParse, valueType: 'list' };
|
||||
}
|
||||
}
|
||||
@@ -287,8 +288,13 @@ function lambdaColumn<T extends Column.Schema>({ value, valueKind, areValuesEqua
|
||||
|
||||
function arrayColumn<T extends Column.Schema>({ array, schema, valueKind }: Column.ArraySpec<T>): Column<T['T']> {
|
||||
const rowCount = array.length;
|
||||
const defaultValue = schema.T;
|
||||
const value: Column<T['T']>['value'] = schema.valueType === 'str'
|
||||
? row => { const v = array[row]; return typeof v === 'string' ? v : '' + v; }
|
||||
? (schema as Column.Schema.Str).transform === 'lowercase'
|
||||
? row => { const v = array[row]; return typeof v === 'string' ? v.toLowerCase() : `${v ?? defaultValue}`.toLowerCase(); }
|
||||
: (schema as Column.Schema.Str).transform === 'uppercase'
|
||||
? row => { const v = array[row]; return typeof v === 'string' ? v.toUpperCase() : `${v ?? defaultValue}`.toUpperCase(); }
|
||||
: row => { const v = array[row]; return typeof v === 'string' ? v : `${v ?? defaultValue}`; }
|
||||
: row => array[row];
|
||||
|
||||
const isTyped = ColumnHelpers.isTypedArray(array);
|
||||
@@ -300,15 +306,35 @@ function arrayColumn<T extends Column.Schema>({ array, schema, valueKind }: Colu
|
||||
value,
|
||||
valueKind: valueKind ? valueKind : row => Column.ValueKind.Present,
|
||||
toArray: schema.valueType === 'str'
|
||||
? params => {
|
||||
const { start, end } = ColumnHelpers.getArrayBounds(rowCount, params);
|
||||
const ret = new (params && typeof params.array !== 'undefined' ? params.array : (array as any).constructor)(end - start) as any;
|
||||
for (let i = 0, _i = end - start; i < _i; i++) {
|
||||
const v = array[start + i];
|
||||
ret[i] = typeof v === 'string' ? v : '' + v;
|
||||
? (schema as Column.Schema.Str).transform === 'lowercase'
|
||||
? params => {
|
||||
const { start, end } = ColumnHelpers.getArrayBounds(rowCount, params);
|
||||
const ret = new (params && typeof params.array !== 'undefined' ? params.array : (array as any).constructor)(end - start) as any;
|
||||
for (let i = 0, _i = end - start; i < _i; i++) {
|
||||
const v = array[start + i];
|
||||
ret[i] = typeof v === 'string' ? v.toLowerCase() : `${v ?? defaultValue}`.toLowerCase();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
: (schema as Column.Schema.Str).transform === 'uppercase'
|
||||
? params => {
|
||||
const { start, end } = ColumnHelpers.getArrayBounds(rowCount, params);
|
||||
const ret = new (params && typeof params.array !== 'undefined' ? params.array : (array as any).constructor)(end - start) as any;
|
||||
for (let i = 0, _i = end - start; i < _i; i++) {
|
||||
const v = array[start + i];
|
||||
ret[i] = typeof v === 'string' ? v.toUpperCase() : `${v ?? defaultValue}`.toUpperCase();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
: params => {
|
||||
const { start, end } = ColumnHelpers.getArrayBounds(rowCount, params);
|
||||
const ret = new (params && typeof params.array !== 'undefined' ? params.array : (array as any).constructor)(end - start) as any;
|
||||
for (let i = 0, _i = end - start; i < _i; i++) {
|
||||
const v = array[start + i];
|
||||
ret[i] = typeof v === 'string' ? v : `${v ?? defaultValue}`;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
: isTyped
|
||||
? params => ColumnHelpers.typedArrayWindow(array, params) as any as ReadonlyArray<T>
|
||||
: params => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2018-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
* @author David Sehnal <david.sehnal@gmail.com>
|
||||
@@ -11,11 +11,13 @@ import { Color } from '../../mol-util/color';
|
||||
import { Vec2, Vec3, Vec4 } from '../../mol-math/linear-algebra';
|
||||
import { LocationIterator } from '../util/location-iterator';
|
||||
import { NullLocation } from '../../mol-model/location';
|
||||
import { LocationColor, ColorTheme } from '../../mol-theme/color';
|
||||
import { Geometry } from './geometry';
|
||||
import { LocationColor, ColorTheme, ColorVolume } from '../../mol-theme/color';
|
||||
import { createNullTexture, Texture } from '../../mol-gl/webgl/texture';
|
||||
|
||||
export type ColorType = 'uniform' | 'instance' | 'group' | 'groupInstance' | 'vertex' | 'vertexInstance' | 'volume' | 'volumeInstance' | 'direct'
|
||||
export type ColorTypeLocation = 'uniform' | 'instance' | 'group' | 'groupInstance' | 'vertex' | 'vertexInstance';
|
||||
export type ColorTypeGrid = 'volume' | 'volumeInstance';
|
||||
export type ColorTypeDirect = 'direct';
|
||||
export type ColorType = ColorTypeLocation | ColorTypeGrid | ColorTypeDirect;
|
||||
|
||||
export type ColorData = {
|
||||
uColor: ValueCell<Vec3>,
|
||||
@@ -29,7 +31,7 @@ export type ColorData = {
|
||||
dUsePalette: ValueCell<boolean>,
|
||||
}
|
||||
|
||||
export function createColors(locationIt: LocationIterator, positionIt: LocationIterator, colorTheme: ColorTheme<any>, colorData?: ColorData): ColorData {
|
||||
export function createColors(locationIt: LocationIterator, positionIt: LocationIterator, colorTheme: ColorTheme<any, any>, colorData?: ColorData): ColorData {
|
||||
const data = _createColors(locationIt, positionIt, colorTheme, colorData);
|
||||
if (colorTheme.palette) {
|
||||
ValueCell.updateIfChanged(data.dUsePalette, true);
|
||||
@@ -40,16 +42,19 @@ export function createColors(locationIt: LocationIterator, positionIt: LocationI
|
||||
return data;
|
||||
}
|
||||
|
||||
function _createColors(locationIt: LocationIterator, positionIt: LocationIterator, colorTheme: ColorTheme<any>, colorData?: ColorData): ColorData {
|
||||
switch (Geometry.getGranularity(locationIt, colorTheme.granularity)) {
|
||||
function _createColors(locationIt: LocationIterator, positionIt: LocationIterator, colorTheme: ColorTheme<any, any>, colorData?: ColorData): ColorData {
|
||||
switch (colorTheme.granularity) {
|
||||
case 'uniform': return createUniformColor(locationIt, colorTheme.color, colorData);
|
||||
case 'instance': return createInstanceColor(locationIt, colorTheme.color, colorData);
|
||||
case 'instance':
|
||||
return locationIt.nonInstanceable
|
||||
? createGroupColor(locationIt, colorTheme.color, colorData)
|
||||
: createInstanceColor(locationIt, colorTheme.color, colorData);
|
||||
case 'group': return createGroupColor(locationIt, colorTheme.color, colorData);
|
||||
case 'groupInstance': return createGroupInstanceColor(locationIt, colorTheme.color, colorData);
|
||||
case 'vertex': return createVertexColor(positionIt, colorTheme.color, colorData);
|
||||
case 'vertexInstance': return createVertexInstanceColor(positionIt, colorTheme.color, colorData);
|
||||
case 'volume': return createGridColor((colorTheme as any).grid, 'volume', colorData);
|
||||
case 'volumeInstance': return createGridColor((colorTheme as any).grid, 'volumeInstance', colorData);
|
||||
case 'volume': return createGridColor(colorTheme.grid, 'volume', colorData);
|
||||
case 'volumeInstance': return createGridColor(colorTheme.grid, 'volumeInstance', colorData);
|
||||
case 'direct': return createDirectColor(colorData);
|
||||
}
|
||||
}
|
||||
@@ -207,12 +212,6 @@ function createVertexInstanceColor(locationIt: LocationIterator, color: Location
|
||||
|
||||
//
|
||||
|
||||
interface ColorVolume {
|
||||
colors: Texture
|
||||
dimension: Vec3
|
||||
transform: Vec4
|
||||
}
|
||||
|
||||
export function createGridColor(grid: ColorVolume, type: ColorType, colorData?: ColorData): ColorData {
|
||||
const { colors, dimension, transform } = grid;
|
||||
const width = colors.getWidth();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2020-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
*/
|
||||
@@ -157,6 +157,7 @@ export namespace Cylinders {
|
||||
doubleSided: PD.Boolean(false, BaseGeometry.CustomQualityParamInfo),
|
||||
ignoreLight: PD.Boolean(false, BaseGeometry.ShadingCategory),
|
||||
xrayShaded: PD.Boolean(false, BaseGeometry.ShadingCategory),
|
||||
transparentBackfaces: PD.Select('off', PD.arrayToOptions(['off', 'on', 'opaque']), BaseGeometry.ShadingCategory),
|
||||
bumpFrequency: PD.Numeric(0, { min: 0, max: 10, step: 0.1 }, BaseGeometry.ShadingCategory),
|
||||
bumpAmplitude: PD.Numeric(1, { min: 0, max: 5, step: 0.1 }, BaseGeometry.ShadingCategory),
|
||||
};
|
||||
@@ -241,6 +242,7 @@ export namespace Cylinders {
|
||||
uDoubleSided: ValueCell.create(props.doubleSided),
|
||||
dIgnoreLight: ValueCell.create(props.ignoreLight),
|
||||
dXrayShaded: ValueCell.create(props.xrayShaded),
|
||||
dTransparentBackfaces: ValueCell.create(props.transparentBackfaces),
|
||||
uBumpFrequency: ValueCell.create(props.bumpFrequency),
|
||||
uBumpAmplitude: ValueCell.create(props.bumpAmplitude),
|
||||
};
|
||||
@@ -258,6 +260,7 @@ export namespace Cylinders {
|
||||
ValueCell.updateIfChanged(values.uDoubleSided, props.doubleSided);
|
||||
ValueCell.updateIfChanged(values.dIgnoreLight, props.ignoreLight);
|
||||
ValueCell.updateIfChanged(values.dXrayShaded, props.xrayShaded);
|
||||
ValueCell.updateIfChanged(values.dTransparentBackfaces, props.transparentBackfaces);
|
||||
ValueCell.updateIfChanged(values.uBumpFrequency, props.bumpFrequency);
|
||||
ValueCell.updateIfChanged(values.uBumpAmplitude, props.bumpAmplitude);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2021-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
*/
|
||||
@@ -34,13 +34,15 @@ export function calcMeshColorSmoothing(input: ColorSmoothingInput, resolution: n
|
||||
|
||||
const isInstanceType = colorType.endsWith('Instance');
|
||||
const box = Box3D.fromSphere3D(Box3D(), isInstanceType ? input.boundingSphere : input.invariantBoundingSphere);
|
||||
const pad = 1 + resolution;
|
||||
const expandedBox = Box3D.expand(Box3D(), box, Vec3.create(pad, pad, pad));
|
||||
|
||||
const scaleFactor = 1 / resolution;
|
||||
const scaledBox = Box3D.scale(Box3D(), box, scaleFactor);
|
||||
const scaledBox = Box3D.scale(Box3D(), expandedBox, scaleFactor);
|
||||
const gridDim = Box3D.size(Vec3(), scaledBox);
|
||||
Vec3.ceil(gridDim, gridDim);
|
||||
Vec3.add(gridDim, gridDim, Vec3.create(2, 2, 2));
|
||||
const { min } = box;
|
||||
const { min } = expandedBox;
|
||||
|
||||
const [xn, yn] = gridDim;
|
||||
const { width, height } = getVolumeTexture2dLayout(gridDim);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2018-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
* @author David Sehnal <david.sehnal@gmail.com>
|
||||
@@ -625,6 +625,7 @@ export namespace Mesh {
|
||||
flatShaded: PD.Boolean(false, BaseGeometry.ShadingCategory),
|
||||
ignoreLight: PD.Boolean(false, BaseGeometry.ShadingCategory),
|
||||
xrayShaded: PD.Boolean(false, BaseGeometry.ShadingCategory),
|
||||
transparentBackfaces: PD.Select('off', PD.arrayToOptions(['off', 'on', 'opaque']), BaseGeometry.ShadingCategory),
|
||||
bumpFrequency: PD.Numeric(0, { min: 0, max: 10, step: 0.1 }, BaseGeometry.ShadingCategory),
|
||||
bumpAmplitude: PD.Numeric(1, { min: 0, max: 5, step: 0.1 }, BaseGeometry.ShadingCategory),
|
||||
};
|
||||
@@ -700,6 +701,7 @@ export namespace Mesh {
|
||||
dFlipSided: ValueCell.create(props.flipSided),
|
||||
dIgnoreLight: ValueCell.create(props.ignoreLight),
|
||||
dXrayShaded: ValueCell.create(props.xrayShaded),
|
||||
dTransparentBackfaces: ValueCell.create(props.transparentBackfaces),
|
||||
uBumpFrequency: ValueCell.create(props.bumpFrequency),
|
||||
uBumpAmplitude: ValueCell.create(props.bumpAmplitude),
|
||||
|
||||
@@ -720,6 +722,7 @@ export namespace Mesh {
|
||||
ValueCell.updateIfChanged(values.dFlipSided, props.flipSided);
|
||||
ValueCell.updateIfChanged(values.dIgnoreLight, props.ignoreLight);
|
||||
ValueCell.updateIfChanged(values.dXrayShaded, props.xrayShaded);
|
||||
ValueCell.updateIfChanged(values.dTransparentBackfaces, props.transparentBackfaces);
|
||||
ValueCell.updateIfChanged(values.uBumpFrequency, props.bumpFrequency);
|
||||
ValueCell.updateIfChanged(values.uBumpAmplitude, props.bumpAmplitude);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2019-2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2019-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
*/
|
||||
@@ -129,6 +129,7 @@ export namespace Spheres {
|
||||
doubleSided: PD.Boolean(false, BaseGeometry.CustomQualityParamInfo),
|
||||
ignoreLight: PD.Boolean(false, BaseGeometry.ShadingCategory),
|
||||
xrayShaded: PD.Boolean(false, BaseGeometry.ShadingCategory),
|
||||
transparentBackfaces: PD.Select('off', PD.arrayToOptions(['off', 'on', 'opaque']), BaseGeometry.ShadingCategory),
|
||||
bumpFrequency: PD.Numeric(0, { min: 0, max: 10, step: 0.1 }, BaseGeometry.ShadingCategory),
|
||||
bumpAmplitude: PD.Numeric(1, { min: 0, max: 5, step: 0.1 }, BaseGeometry.ShadingCategory),
|
||||
};
|
||||
@@ -208,6 +209,7 @@ export namespace Spheres {
|
||||
uDoubleSided: ValueCell.create(props.doubleSided),
|
||||
dIgnoreLight: ValueCell.create(props.ignoreLight),
|
||||
dXrayShaded: ValueCell.create(props.xrayShaded),
|
||||
dTransparentBackfaces: ValueCell.create(props.transparentBackfaces),
|
||||
uBumpFrequency: ValueCell.create(props.bumpFrequency),
|
||||
uBumpAmplitude: ValueCell.create(props.bumpAmplitude),
|
||||
};
|
||||
@@ -225,6 +227,7 @@ export namespace Spheres {
|
||||
ValueCell.updateIfChanged(values.uDoubleSided, props.doubleSided);
|
||||
ValueCell.updateIfChanged(values.dIgnoreLight, props.ignoreLight);
|
||||
ValueCell.updateIfChanged(values.dXrayShaded, props.xrayShaded);
|
||||
ValueCell.updateIfChanged(values.dTransparentBackfaces, props.transparentBackfaces);
|
||||
ValueCell.updateIfChanged(values.uBumpFrequency, props.bumpFrequency);
|
||||
ValueCell.updateIfChanged(values.uBumpAmplitude, props.bumpAmplitude);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2021-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
*/
|
||||
@@ -259,13 +259,15 @@ export function calcTextureMeshColorSmoothing(input: ColorSmoothingInput, resolu
|
||||
|
||||
const isInstanceType = input.colorType.endsWith('Instance');
|
||||
const box = Box3D.fromSphere3D(Box3D(), isInstanceType ? input.boundingSphere : input.invariantBoundingSphere);
|
||||
const pad = 1 + resolution;
|
||||
const expandedBox = Box3D.expand(Box3D(), box, Vec3.create(pad, pad, pad));
|
||||
|
||||
const scaleFactor = 1 / resolution;
|
||||
const scaledBox = Box3D.scale(Box3D(), box, scaleFactor);
|
||||
const scaledBox = Box3D.scale(Box3D(), expandedBox, scaleFactor);
|
||||
const gridDim = Box3D.size(Vec3(), scaledBox);
|
||||
Vec3.ceil(gridDim, gridDim);
|
||||
Vec3.add(gridDim, gridDim, Vec3.create(2, 2, 2));
|
||||
const { min } = box;
|
||||
const { min } = expandedBox;
|
||||
|
||||
const [dx, dy, dz] = gridDim;
|
||||
const { texDimX: width, texDimY: height, texCols } = getTexture2dSize(gridDim);
|
||||
@@ -308,7 +310,7 @@ export function calcTextureMeshColorSmoothing(input: ColorSmoothingInput, resolu
|
||||
accumulateTexture.attachFramebuffer(framebuffer, 0);
|
||||
countTexture.attachFramebuffer(framebuffer, 1);
|
||||
|
||||
const accumulateRenderable = getAccumulateRenderable(webgl, input, box, resolution, stride);
|
||||
const accumulateRenderable = getAccumulateRenderable(webgl, input, expandedBox, resolution, stride);
|
||||
state.currentRenderItemId = -1;
|
||||
|
||||
framebuffer.bind();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2019-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2019-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
*/
|
||||
@@ -24,6 +24,7 @@ import { Vec2, Vec4 } from '../../../mol-math/linear-algebra';
|
||||
import { createEmptyClipping } from '../clipping-data';
|
||||
import { NullLocation } from '../../../mol-model/location';
|
||||
import { createEmptySubstance } from '../substance-data';
|
||||
import { RenderableState } from '../../../mol-gl/renderable';
|
||||
|
||||
export interface TextureMesh {
|
||||
readonly kind: 'texture-mesh',
|
||||
@@ -113,6 +114,7 @@ export namespace TextureMesh {
|
||||
flatShaded: PD.Boolean(false, BaseGeometry.ShadingCategory),
|
||||
ignoreLight: PD.Boolean(false, BaseGeometry.ShadingCategory),
|
||||
xrayShaded: PD.Boolean(false, BaseGeometry.ShadingCategory),
|
||||
transparentBackfaces: PD.Select('off', PD.arrayToOptions(['off', 'on', 'opaque']), BaseGeometry.ShadingCategory),
|
||||
bumpFrequency: PD.Numeric(0, { min: 0, max: 10, step: 0.1 }, BaseGeometry.ShadingCategory),
|
||||
bumpAmplitude: PD.Numeric(1, { min: 0, max: 5, step: 0.1 }, BaseGeometry.ShadingCategory),
|
||||
};
|
||||
@@ -125,8 +127,8 @@ export namespace TextureMesh {
|
||||
createValuesSimple,
|
||||
updateValues,
|
||||
updateBoundingSphere,
|
||||
createRenderableState: BaseGeometry.createRenderableState,
|
||||
updateRenderableState: BaseGeometry.updateRenderableState,
|
||||
createRenderableState,
|
||||
updateRenderableState,
|
||||
createPositionIterator: () => LocationIterator(1, 1, 1, () => NullLocation)
|
||||
};
|
||||
|
||||
@@ -172,6 +174,7 @@ export namespace TextureMesh {
|
||||
dFlipSided: ValueCell.create(props.flipSided),
|
||||
dIgnoreLight: ValueCell.create(props.ignoreLight),
|
||||
dXrayShaded: ValueCell.create(props.xrayShaded),
|
||||
dTransparentBackfaces: ValueCell.create(props.transparentBackfaces),
|
||||
uBumpFrequency: ValueCell.create(props.bumpFrequency),
|
||||
uBumpAmplitude: ValueCell.create(props.bumpAmplitude),
|
||||
|
||||
@@ -192,6 +195,7 @@ export namespace TextureMesh {
|
||||
ValueCell.updateIfChanged(values.dFlipSided, props.flipSided);
|
||||
ValueCell.updateIfChanged(values.dIgnoreLight, props.ignoreLight);
|
||||
ValueCell.updateIfChanged(values.dXrayShaded, props.xrayShaded);
|
||||
ValueCell.updateIfChanged(values.dTransparentBackfaces, props.transparentBackfaces);
|
||||
ValueCell.updateIfChanged(values.uBumpFrequency, props.bumpFrequency);
|
||||
ValueCell.updateIfChanged(values.uBumpAmplitude, props.bumpAmplitude);
|
||||
}
|
||||
@@ -208,4 +212,16 @@ export namespace TextureMesh {
|
||||
ValueCell.update(values.uInvariantBoundingSphere, Vec4.fromSphere(values.uInvariantBoundingSphere.ref.value, invariantBoundingSphere));
|
||||
}
|
||||
}
|
||||
|
||||
function createRenderableState(props: PD.Values<Params>): RenderableState {
|
||||
const state = BaseGeometry.createRenderableState(props);
|
||||
updateRenderableState(state, props);
|
||||
return state;
|
||||
}
|
||||
|
||||
function updateRenderableState(state: RenderableState, props: PD.Values<Params>) {
|
||||
BaseGeometry.updateRenderableState(state, props);
|
||||
state.opaque = state.opaque && !props.xrayShaded;
|
||||
state.writeDepth = state.opaque;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2019-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2019-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
*/
|
||||
@@ -29,6 +29,7 @@ export function applyTransparencyValue(array: Uint8Array, start: number, end: nu
|
||||
}
|
||||
|
||||
export function getTransparencyAverage(array: Uint8Array, count: number): number {
|
||||
if (count === 0 || array.length < count) return 0;
|
||||
let sum = 0;
|
||||
for (let i = 0; i < count; ++i) {
|
||||
sum += array[i];
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2020-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2020-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
*/
|
||||
@@ -26,6 +26,7 @@ export const CylindersSchema = {
|
||||
uDoubleSided: UniformSpec('b'),
|
||||
dIgnoreLight: DefineSpec('boolean'),
|
||||
dXrayShaded: DefineSpec('boolean'),
|
||||
dTransparentBackfaces: DefineSpec('string', ['off', 'on', 'opaque']),
|
||||
uBumpFrequency: UniformSpec('f'),
|
||||
uBumpAmplitude: UniformSpec('f'),
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2018-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
*/
|
||||
@@ -22,6 +22,7 @@ export const MeshSchema = {
|
||||
dFlipSided: DefineSpec('boolean'),
|
||||
dIgnoreLight: DefineSpec('boolean'),
|
||||
dXrayShaded: DefineSpec('boolean'),
|
||||
dTransparentBackfaces: DefineSpec('string', ['off', 'on', 'opaque']),
|
||||
uBumpFrequency: UniformSpec('f'),
|
||||
uBumpAmplitude: UniformSpec('f'),
|
||||
meta: ValueSpec('unknown')
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2018-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
*/
|
||||
@@ -153,7 +153,7 @@ export const GlobalUniformSchema = {
|
||||
|
||||
uXrayEdgeFalloff: UniformSpec('f'),
|
||||
|
||||
uRenderWboit: UniformSpec('b'),
|
||||
uRenderMask: UniformSpec('i'),
|
||||
uMarkingDepthTest: UniformSpec('b'),
|
||||
uMarkingType: UniformSpec('i'),
|
||||
uPickType: UniformSpec('i'),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2019-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2019-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
*/
|
||||
@@ -23,6 +23,7 @@ export const SpheresSchema = {
|
||||
uDoubleSided: UniformSpec('b'),
|
||||
dIgnoreLight: DefineSpec('boolean'),
|
||||
dXrayShaded: DefineSpec('boolean'),
|
||||
dTransparentBackfaces: DefineSpec('string', ['off', 'on', 'opaque']),
|
||||
uBumpFrequency: UniformSpec('f'),
|
||||
uBumpAmplitude: UniformSpec('f'),
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2019-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2019-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
*/
|
||||
@@ -23,6 +23,7 @@ export const TextureMeshSchema = {
|
||||
dFlipSided: DefineSpec('boolean'),
|
||||
dIgnoreLight: DefineSpec('boolean'),
|
||||
dXrayShaded: DefineSpec('boolean'),
|
||||
dTransparentBackfaces: DefineSpec('string', ['off', 'on', 'opaque']),
|
||||
uBumpFrequency: UniformSpec('f'),
|
||||
uBumpAmplitude: UniformSpec('f'),
|
||||
meta: ValueSpec('unknown')
|
||||
|
||||
@@ -54,18 +54,19 @@ interface Renderer {
|
||||
readonly props: Readonly<RendererProps>
|
||||
|
||||
clear: (toBackgroundColor: boolean, ignoreTransparentBackground?: boolean) => void
|
||||
clearDepth: () => void
|
||||
clearDepth: (packed?: boolean) => void
|
||||
update: (camera: ICamera) => void
|
||||
|
||||
renderPick: (group: Scene.Group, camera: ICamera, variant: GraphicsRenderVariant, depthTexture: Texture | null, pickType: PickType) => void
|
||||
renderPick: (group: Scene.Group, camera: ICamera, variant: 'pick' | 'depth', depthTexture: Texture | null, pickType: PickType) => void
|
||||
renderDepth: (group: Scene.Group, camera: ICamera, depthTexture: Texture | null) => void
|
||||
renderDepthOpaque: (group: Scene.Group, camera: ICamera, depthTexture: Texture | null) => void
|
||||
renderDepthTransparent: (group: Scene.Group, camera: ICamera, depthTexture: Texture | null) => void
|
||||
renderMarkingDepth: (group: Scene.Group, camera: ICamera, depthTexture: Texture | null) => void
|
||||
renderMarkingMask: (group: Scene.Group, camera: ICamera, depthTexture: Texture | null) => void
|
||||
renderBlended: (group: Scene.Group, camera: ICamera, depthTexture: Texture | null) => void
|
||||
renderBlendedOpaque: (group: Scene.Group, camera: ICamera, depthTexture: Texture | null) => void
|
||||
renderBlendedTransparent: (group: Scene.Group, camera: ICamera, depthTexture: Texture | null) => void
|
||||
renderBlendedVolumeOpaque: (group: Scene.Group, camera: ICamera, depthTexture: Texture | null) => void
|
||||
renderBlendedVolumeTransparent: (group: Scene.Group, camera: ICamera, depthTexture: Texture | null) => void
|
||||
renderBlendedVolume: (group: Scene.Group, camera: ICamera, depthTexture: Texture | null) => void
|
||||
renderWboitOpaque: (group: Scene.Group, camera: ICamera, depthTexture: Texture | null) => void
|
||||
renderWboitTransparent: (group: Scene.Group, camera: ICamera, depthTexture: Texture | null) => void
|
||||
|
||||
@@ -135,6 +136,18 @@ function getLight(props: RendererProps['light'], light?: Light): Light {
|
||||
}
|
||||
|
||||
namespace Renderer {
|
||||
const enum Flag {
|
||||
None = 0,
|
||||
BlendedFront = 1,
|
||||
BlendedBack = 2
|
||||
}
|
||||
|
||||
const enum Mask {
|
||||
All = 0,
|
||||
Opaque = 1,
|
||||
Transparent = 2,
|
||||
}
|
||||
|
||||
export function create(ctx: WebGLContext, props: Partial<RendererProps> = {}): Renderer {
|
||||
const { gl, state, stats } = ctx;
|
||||
const p = PD.merge(RendererParams, PD.getDefaultValues(RendererParams), props);
|
||||
@@ -146,7 +159,9 @@ namespace Renderer {
|
||||
|
||||
let transparentBackground = false;
|
||||
|
||||
const emptyDepthTexture = ctx.resources.texture('image-depth', 'depth', 'ushort', 'nearest');
|
||||
const emptyDepthTexture = ctx.resources.texture('image-uint8', 'rgba', 'ubyte', 'nearest');
|
||||
emptyDepthTexture.define(1, 1);
|
||||
emptyDepthTexture.load({ array: new Uint8Array([255, 255, 255, 255]), width: 1, height: 1 });
|
||||
const sharedTexturesList: Textures = [
|
||||
['tDepth', emptyDepthTexture]
|
||||
];
|
||||
@@ -191,7 +206,7 @@ namespace Renderer {
|
||||
uFogFar: ValueCell.create(10000),
|
||||
uFogColor: ValueCell.create(bgColor),
|
||||
|
||||
uRenderWboit: ValueCell.create(false),
|
||||
uRenderMask: ValueCell.create(0),
|
||||
uMarkingDepthTest: ValueCell.create(false),
|
||||
uPickType: ValueCell.create(PickType.None),
|
||||
uMarkingType: ValueCell.create(MarkingType.None),
|
||||
@@ -220,7 +235,7 @@ namespace Renderer {
|
||||
|
||||
let globalUniformsNeedUpdate = true;
|
||||
|
||||
const renderObject = (r: GraphicsRenderable, variant: GraphicsRenderVariant) => {
|
||||
const renderObject = (r: GraphicsRenderable, variant: GraphicsRenderVariant, flag: Flag) => {
|
||||
if (r.state.disposed || !r.state.visible || (!r.state.pickable && variant === 'pick')) {
|
||||
return;
|
||||
}
|
||||
@@ -259,6 +274,24 @@ namespace Renderer {
|
||||
state.disable(gl.DEPTH_TEST);
|
||||
state.depthMask(false);
|
||||
}
|
||||
} else if (flag === Flag.BlendedFront) {
|
||||
state.enable(gl.CULL_FACE);
|
||||
if (r.values.dFlipSided?.ref.value) {
|
||||
state.frontFace(gl.CW);
|
||||
state.cullFace(gl.FRONT);
|
||||
} else {
|
||||
state.frontFace(gl.CCW);
|
||||
state.cullFace(gl.BACK);
|
||||
}
|
||||
} else if (flag === Flag.BlendedBack) {
|
||||
state.enable(gl.CULL_FACE);
|
||||
if (r.values.dFlipSided?.ref.value) {
|
||||
state.frontFace(gl.CW);
|
||||
state.cullFace(gl.BACK);
|
||||
} else {
|
||||
state.frontFace(gl.CCW);
|
||||
state.cullFace(gl.FRONT);
|
||||
}
|
||||
} else {
|
||||
if (r.values.uDoubleSided) {
|
||||
if (r.values.uDoubleSided.ref.value || r.values.hasReflection.ref.value) {
|
||||
@@ -271,14 +304,9 @@ namespace Renderer {
|
||||
state.disable(gl.CULL_FACE);
|
||||
}
|
||||
|
||||
if (r.values.dFlipSided) {
|
||||
if (r.values.dFlipSided.ref.value) {
|
||||
state.frontFace(gl.CW);
|
||||
state.cullFace(gl.FRONT);
|
||||
} else {
|
||||
state.frontFace(gl.CCW);
|
||||
state.cullFace(gl.BACK);
|
||||
}
|
||||
if (r.values.dFlipSided?.ref.value) {
|
||||
state.frontFace(gl.CW);
|
||||
state.cullFace(gl.FRONT);
|
||||
} else {
|
||||
// webgl default
|
||||
state.frontFace(gl.CCW);
|
||||
@@ -308,7 +336,7 @@ namespace Renderer {
|
||||
ValueCell.updateIfChanged(globalUniforms.uTransparentBackground, transparentBackground);
|
||||
};
|
||||
|
||||
const updateInternal = (group: Scene.Group, camera: ICamera, depthTexture: Texture | null, renderWboit: boolean, markingDepthTest: boolean) => {
|
||||
const updateInternal = (group: Scene.Group, camera: ICamera, depthTexture: Texture | null, renderMask: Mask, markingDepthTest: boolean) => {
|
||||
arrayMapUpsert(sharedTexturesList, 'tDepth', depthTexture || emptyDepthTexture);
|
||||
|
||||
ValueCell.update(globalUniforms.uModel, group.view);
|
||||
@@ -317,7 +345,7 @@ namespace Renderer {
|
||||
ValueCell.update(globalUniforms.uModelViewProjection, Mat4.mul(modelViewProjection, modelView, camera.projection));
|
||||
ValueCell.update(globalUniforms.uInvModelViewProjection, Mat4.invert(invModelViewProjection, modelViewProjection));
|
||||
|
||||
ValueCell.updateIfChanged(globalUniforms.uRenderWboit, renderWboit);
|
||||
ValueCell.updateIfChanged(globalUniforms.uRenderMask, renderMask);
|
||||
ValueCell.updateIfChanged(globalUniforms.uMarkingDepthTest, markingDepthTest);
|
||||
|
||||
state.enable(gl.SCISSOR_TEST);
|
||||
@@ -336,13 +364,13 @@ namespace Renderer {
|
||||
state.enable(gl.DEPTH_TEST);
|
||||
state.depthMask(true);
|
||||
|
||||
updateInternal(group, camera, depthTexture, false, false);
|
||||
updateInternal(group, camera, depthTexture, Mask.All, false);
|
||||
ValueCell.updateIfChanged(globalUniforms.uPickType, pickType);
|
||||
|
||||
const { renderables } = group;
|
||||
for (let i = 0, il = renderables.length; i < il; ++i) {
|
||||
if (!renderables[i].state.colorOnly) {
|
||||
renderObject(renderables[i], variant);
|
||||
renderObject(renderables[i], variant, Flag.None);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -352,11 +380,43 @@ namespace Renderer {
|
||||
state.enable(gl.DEPTH_TEST);
|
||||
state.depthMask(true);
|
||||
|
||||
updateInternal(group, camera, depthTexture, false, false);
|
||||
updateInternal(group, camera, depthTexture, Mask.All, false);
|
||||
|
||||
const { renderables } = group;
|
||||
for (let i = 0, il = renderables.length; i < il; ++i) {
|
||||
renderObject(renderables[i], 'depth');
|
||||
renderObject(renderables[i], 'depth', Flag.None);
|
||||
}
|
||||
};
|
||||
|
||||
const renderDepthOpaque = (group: Scene.Group, camera: ICamera, depthTexture: Texture | null) => {
|
||||
state.disable(gl.BLEND);
|
||||
state.enable(gl.DEPTH_TEST);
|
||||
state.depthMask(true);
|
||||
|
||||
updateInternal(group, camera, depthTexture, Mask.Opaque, false);
|
||||
|
||||
const { renderables } = group;
|
||||
for (let i = 0, il = renderables.length; i < il; ++i) {
|
||||
const r = renderables[i];
|
||||
if (r.state.opaque && r.values.transparencyAverage.ref.value !== 1 && !r.values.dXrayShaded?.ref.value) {
|
||||
renderObject(r, 'depth', Flag.None);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const renderDepthTransparent = (group: Scene.Group, camera: ICamera, depthTexture: Texture | null) => {
|
||||
state.disable(gl.BLEND);
|
||||
state.enable(gl.DEPTH_TEST);
|
||||
state.depthMask(true);
|
||||
|
||||
updateInternal(group, camera, depthTexture, Mask.Transparent, false);
|
||||
|
||||
const { renderables } = group;
|
||||
for (let i = 0, il = renderables.length; i < il; ++i) {
|
||||
const r = renderables[i];
|
||||
if (!r.state.opaque || r.values.transparencyAverage.ref.value > 0 || r.values.dXrayShaded?.ref.value) {
|
||||
renderObject(r, 'depth', Flag.None);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -365,7 +425,7 @@ namespace Renderer {
|
||||
state.enable(gl.DEPTH_TEST);
|
||||
state.depthMask(true);
|
||||
|
||||
updateInternal(group, camera, depthTexture, false, false);
|
||||
updateInternal(group, camera, depthTexture, Mask.All, false);
|
||||
ValueCell.updateIfChanged(globalUniforms.uMarkingType, MarkingType.Depth);
|
||||
|
||||
const { renderables } = group;
|
||||
@@ -373,7 +433,7 @@ namespace Renderer {
|
||||
const r = renderables[i];
|
||||
|
||||
if (r.values.markerAverage.ref.value !== 1) {
|
||||
renderObject(renderables[i], 'marking');
|
||||
renderObject(renderables[i], 'marking', Flag.None);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -383,7 +443,7 @@ namespace Renderer {
|
||||
state.enable(gl.DEPTH_TEST);
|
||||
state.depthMask(true);
|
||||
|
||||
updateInternal(group, camera, depthTexture, false, !!depthTexture);
|
||||
updateInternal(group, camera, depthTexture, Mask.All, !!depthTexture);
|
||||
ValueCell.updateIfChanged(globalUniforms.uMarkingType, MarkingType.Mask);
|
||||
|
||||
const { renderables } = group;
|
||||
@@ -391,7 +451,7 @@ namespace Renderer {
|
||||
const r = renderables[i];
|
||||
|
||||
if (r.values.markerAverage.ref.value > 0) {
|
||||
renderObject(renderables[i], 'marking');
|
||||
renderObject(renderables[i], 'marking', Flag.None);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -406,13 +466,15 @@ namespace Renderer {
|
||||
state.enable(gl.DEPTH_TEST);
|
||||
state.depthMask(true);
|
||||
|
||||
updateInternal(group, camera, depthTexture, false, false);
|
||||
updateInternal(group, camera, depthTexture, Mask.Opaque, false);
|
||||
|
||||
const { renderables } = group;
|
||||
for (let i = 0, il = renderables.length; i < il; ++i) {
|
||||
const r = renderables[i];
|
||||
if (r.state.opaque) {
|
||||
renderObject(r, 'colorBlended');
|
||||
renderObject(r, 'colorBlended', Flag.None);
|
||||
} else if (r.values.uDoubleSided?.ref.value && r.values.dTransparentBackfaces?.ref.value === 'opaque') {
|
||||
renderObject(r, 'colorBlended', Flag.BlendedBack);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -420,7 +482,7 @@ namespace Renderer {
|
||||
const renderBlendedTransparent = (group: Scene.Group, camera: ICamera, depthTexture: Texture | null) => {
|
||||
state.enable(gl.DEPTH_TEST);
|
||||
|
||||
updateInternal(group, camera, depthTexture, false, false);
|
||||
updateInternal(group, camera, depthTexture, Mask.Transparent, false);
|
||||
|
||||
const { renderables } = group;
|
||||
|
||||
@@ -435,53 +497,38 @@ namespace Renderer {
|
||||
for (let i = 0, il = renderables.length; i < il; ++i) {
|
||||
const r = renderables[i];
|
||||
if (!r.state.opaque && r.state.writeDepth) {
|
||||
renderObject(r, 'colorBlended');
|
||||
renderObject(r, 'colorBlended', Flag.None);
|
||||
}
|
||||
}
|
||||
|
||||
state.depthMask(false);
|
||||
for (let i = 0, il = renderables.length; i < il; ++i) {
|
||||
const r = renderables[i];
|
||||
if (!r.state.opaque && !r.state.writeDepth) {
|
||||
renderObject(r, 'colorBlended');
|
||||
if ((!r.state.opaque && !r.state.writeDepth) || r.values.transparencyAverage.ref.value > 0) {
|
||||
if (r.values.uDoubleSided?.ref.value) {
|
||||
// render frontfaces and backfaces separately to avoid artefacts
|
||||
if (r.values.dTransparentBackfaces?.ref.value !== 'opaque') {
|
||||
renderObject(r, 'colorBlended', Flag.BlendedBack);
|
||||
}
|
||||
renderObject(r, 'colorBlended', Flag.BlendedFront);
|
||||
} else {
|
||||
renderObject(r, 'colorBlended', Flag.None);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const renderBlendedVolumeOpaque = (group: Scene.Group, camera: ICamera, depthTexture: Texture | null) => {
|
||||
const renderBlendedVolume = (group: Scene.Group, camera: ICamera, depthTexture: Texture | null) => {
|
||||
state.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA);
|
||||
state.enable(gl.BLEND);
|
||||
|
||||
updateInternal(group, camera, depthTexture, false, false);
|
||||
updateInternal(group, camera, depthTexture, Mask.Transparent, false);
|
||||
|
||||
const { renderables } = group;
|
||||
for (let i = 0, il = renderables.length; i < il; ++i) {
|
||||
const r = renderables[i];
|
||||
|
||||
// TODO: simplify, handle in renderable.state???
|
||||
// uAlpha is updated in "render" so we need to recompute it here
|
||||
const alpha = clamp(r.values.alpha.ref.value * r.state.alphaFactor, 0, 1);
|
||||
if (alpha === 1 && r.values.transparencyAverage.ref.value !== 1 && !r.values.dXrayShaded?.ref.value) {
|
||||
renderObject(r, 'colorBlended');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const renderBlendedVolumeTransparent = (group: Scene.Group, camera: ICamera, depthTexture: Texture | null) => {
|
||||
state.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA);
|
||||
state.enable(gl.BLEND);
|
||||
|
||||
updateInternal(group, camera, depthTexture, false, false);
|
||||
|
||||
const { renderables } = group;
|
||||
for (let i = 0, il = renderables.length; i < il; ++i) {
|
||||
const r = renderables[i];
|
||||
|
||||
// TODO: simplify, handle in renderable.state???
|
||||
// uAlpha is updated in "render" so we need to recompute it here
|
||||
const alpha = clamp(r.values.alpha.ref.value * r.state.alphaFactor, 0, 1);
|
||||
if (alpha < 1 || r.values.transparencyAverage.ref.value > 0 || r.values.dXrayShaded?.ref.value) {
|
||||
renderObject(r, 'colorBlended');
|
||||
if (r.values.dGeometryType.ref.value === 'directVolume') {
|
||||
renderObject(r, 'colorBlended', Flag.None);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -491,7 +538,7 @@ namespace Renderer {
|
||||
state.enable(gl.DEPTH_TEST);
|
||||
state.depthMask(true);
|
||||
|
||||
updateInternal(group, camera, depthTexture, false, false);
|
||||
updateInternal(group, camera, depthTexture, Mask.Opaque, false);
|
||||
|
||||
const { renderables } = group;
|
||||
for (let i = 0, il = renderables.length; i < il; ++i) {
|
||||
@@ -500,14 +547,14 @@ namespace Renderer {
|
||||
// TODO: simplify, handle in renderable.state???
|
||||
// uAlpha is updated in "render" so we need to recompute it here
|
||||
const alpha = clamp(r.values.alpha.ref.value * r.state.alphaFactor, 0, 1);
|
||||
if (alpha === 1 && r.values.transparencyAverage.ref.value !== 1 && r.values.dGeometryType.ref.value !== 'directVolume' && r.values.dPointStyle?.ref.value !== 'fuzzy' && !r.values.dXrayShaded?.ref.value) {
|
||||
renderObject(r, 'colorWboit');
|
||||
if ((alpha === 1 && r.values.transparencyAverage.ref.value !== 1 && r.values.dGeometryType.ref.value !== 'directVolume' && r.values.dPointStyle?.ref.value !== 'fuzzy' && !r.values.dXrayShaded?.ref.value) || r.values.dTransparentBackfaces?.ref.value === 'opaque') {
|
||||
renderObject(r, 'colorWboit', Flag.None);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const renderWboitTransparent = (group: Scene.Group, camera: ICamera, depthTexture: Texture | null) => {
|
||||
updateInternal(group, camera, depthTexture, true, false);
|
||||
updateInternal(group, camera, depthTexture, Mask.Transparent, false);
|
||||
|
||||
const { renderables } = group;
|
||||
for (let i = 0, il = renderables.length; i < il; ++i) {
|
||||
@@ -517,7 +564,7 @@ namespace Renderer {
|
||||
// uAlpha is updated in "render" so we need to recompute it here
|
||||
const alpha = clamp(r.values.alpha.ref.value * r.state.alphaFactor, 0, 1);
|
||||
if (alpha < 1 || r.values.transparencyAverage.ref.value > 0 || r.values.dGeometryType.ref.value === 'directVolume' || r.values.dPointStyle?.ref.value === 'fuzzy' || !!r.values.uBackgroundColor || r.values.dXrayShaded?.ref.value) {
|
||||
renderObject(r, 'colorWboit');
|
||||
renderObject(r, 'colorWboit', Flag.None);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -538,23 +585,31 @@ namespace Renderer {
|
||||
}
|
||||
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
|
||||
},
|
||||
clearDepth: () => {
|
||||
clearDepth: (packed = false) => {
|
||||
state.enable(gl.SCISSOR_TEST);
|
||||
state.enable(gl.DEPTH_TEST);
|
||||
state.depthMask(true);
|
||||
gl.clear(gl.DEPTH_BUFFER_BIT);
|
||||
|
||||
if (packed) {
|
||||
state.colorMask(true, true, true, true);
|
||||
state.clearColor(1, 1, 1, 1);
|
||||
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
|
||||
} else {
|
||||
state.enable(gl.DEPTH_TEST);
|
||||
state.depthMask(true);
|
||||
gl.clear(gl.DEPTH_BUFFER_BIT);
|
||||
}
|
||||
},
|
||||
update,
|
||||
|
||||
renderPick,
|
||||
renderDepth,
|
||||
renderDepthOpaque,
|
||||
renderDepthTransparent,
|
||||
renderMarkingDepth,
|
||||
renderMarkingMask,
|
||||
renderBlended,
|
||||
renderBlendedOpaque,
|
||||
renderBlendedTransparent,
|
||||
renderBlendedVolumeOpaque,
|
||||
renderBlendedVolumeTransparent,
|
||||
renderBlendedVolume,
|
||||
renderWboitOpaque,
|
||||
renderWboitTransparent,
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ import { BoundaryHelper } from '../mol-math/geometry/boundary-helper';
|
||||
import { hash1 } from '../mol-data/util';
|
||||
import { GraphicsRenderable } from './renderable';
|
||||
import { GraphicsRenderVariants } from './webgl/render-item';
|
||||
import { clamp } from '../mol-math/interpolate';
|
||||
|
||||
const boundaryHelper = new BoundaryHelper('98');
|
||||
|
||||
@@ -79,7 +80,8 @@ interface Scene extends Object3D {
|
||||
has: (o: GraphicsRenderObject) => boolean
|
||||
clear: () => void
|
||||
forEach: (callbackFn: (value: GraphicsRenderable, key: GraphicsRenderObject) => void) => void
|
||||
getMarkerAverage: () => number
|
||||
readonly markerAverage: number
|
||||
readonly opacityAverage: number
|
||||
}
|
||||
|
||||
namespace Scene {
|
||||
@@ -99,6 +101,9 @@ namespace Scene {
|
||||
let boundingSphereDirty = true;
|
||||
let boundingSphereVisibleDirty = true;
|
||||
|
||||
let markerAverage = 0;
|
||||
let opacityAverage = 0;
|
||||
|
||||
const object3d = Object3D.create();
|
||||
const { view, position, direction, up } = object3d;
|
||||
|
||||
@@ -155,6 +160,7 @@ namespace Scene {
|
||||
}
|
||||
|
||||
renderables.sort(renderableSort);
|
||||
opacityAverage = calculateOpacityAverage();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -176,12 +182,42 @@ namespace Scene {
|
||||
const newVisibleHash = computeVisibleHash();
|
||||
if (newVisibleHash !== visibleHash) {
|
||||
boundingSphereVisibleDirty = true;
|
||||
opacityAverage = calculateOpacityAverage();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function calculateMarkerAverage() {
|
||||
if (primitives.length === 0) return 0;
|
||||
let count = 0;
|
||||
let markerAverage = 0;
|
||||
for (let i = 0, il = primitives.length; i < il; ++i) {
|
||||
if (!primitives[i].state.visible) continue;
|
||||
markerAverage += primitives[i].values.markerAverage.ref.value;
|
||||
count += 1;
|
||||
}
|
||||
return count > 0 ? markerAverage / count : 0;
|
||||
}
|
||||
|
||||
function calculateOpacityAverage() {
|
||||
if (primitives.length === 0) return 0;
|
||||
let count = 0;
|
||||
let opacityAverage = 0;
|
||||
for (let i = 0, il = primitives.length; i < il; ++i) {
|
||||
const p = primitives[i];
|
||||
if (!p.state.visible) continue;
|
||||
// TODO: simplify, handle in renderable.state???
|
||||
// uAlpha is updated in "render" so we need to recompute it here
|
||||
const alpha = clamp(p.values.alpha.ref.value * p.state.alphaFactor, 0, 1);
|
||||
const xray = p.values.dXrayShaded?.ref.value ? 0.5 : 1;
|
||||
opacityAverage += (1 - p.values.transparencyAverage.ref.value) * alpha * xray;
|
||||
count += 1;
|
||||
}
|
||||
return count > 0 ? opacityAverage / count : 0;
|
||||
}
|
||||
|
||||
return {
|
||||
view, position, direction, up,
|
||||
|
||||
@@ -207,6 +243,8 @@ namespace Scene {
|
||||
} else {
|
||||
syncVisibility();
|
||||
}
|
||||
markerAverage = calculateMarkerAverage();
|
||||
opacityAverage = calculateOpacityAverage();
|
||||
},
|
||||
add: (o: GraphicsRenderObject) => commitQueue.add(o),
|
||||
remove: (o: GraphicsRenderObject) => commitQueue.remove(o),
|
||||
@@ -245,16 +283,11 @@ namespace Scene {
|
||||
}
|
||||
return boundingSphereVisible;
|
||||
},
|
||||
getMarkerAverage() {
|
||||
if (primitives.length === 0 && volumes.length === 0) return 0;
|
||||
let markerAverage = 0;
|
||||
for (let i = 0, il = primitives.length; i < il; ++i) {
|
||||
markerAverage += primitives[i].values.markerAverage.ref.value;
|
||||
}
|
||||
for (let i = 0, il = volumes.length; i < il; ++i) {
|
||||
markerAverage += volumes[i].values.markerAverage.ref.value;
|
||||
}
|
||||
return markerAverage / (primitives.length + volumes.length);
|
||||
get markerAverage() {
|
||||
return markerAverage;
|
||||
},
|
||||
get opacityAverage() {
|
||||
return opacityAverage;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -5,5 +5,9 @@ if (interior) {
|
||||
} else {
|
||||
gl_FragColor.rgb *= 1.0 - uInteriorDarkening;
|
||||
}
|
||||
|
||||
#ifdef dTransparentBackfaces_opaque
|
||||
gl_FragColor.a = 1.0;
|
||||
#endif
|
||||
}
|
||||
`;
|
||||
@@ -31,11 +31,34 @@ export const assign_material_color = `
|
||||
#elif defined(dRenderVariant_pick)
|
||||
vec4 material = vColor;
|
||||
#elif defined(dRenderVariant_depth)
|
||||
#ifdef enabledFragDepth
|
||||
vec4 material = packDepthToRGBA(gl_FragDepthEXT);
|
||||
if (fragmentDepth > getDepth(gl_FragCoord.xy / uDrawingBufferSize)) {
|
||||
discard;
|
||||
}
|
||||
|
||||
#ifndef dXrayShaded
|
||||
#if defined(dTransparency)
|
||||
float dta = 1.0 - vTransparency;
|
||||
if (vTransparency < 0.2) dta = 1.0; // hard cutoff looks better
|
||||
|
||||
if (uRenderMask == MaskTransparent && uAlpha * dta == 1.0) {
|
||||
discard;
|
||||
} else if (uRenderMask == MaskOpaque && uAlpha * dta < 1.0) {
|
||||
discard;
|
||||
}
|
||||
#else
|
||||
if (uRenderMask == MaskTransparent && uAlpha == 1.0) {
|
||||
discard;
|
||||
} else if (uRenderMask == MaskOpaque && uAlpha < 1.0) {
|
||||
discard;
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
vec4 material = packDepthToRGBA(gl_FragCoord.z);
|
||||
if (uRenderMask == MaskOpaque) {
|
||||
discard;
|
||||
}
|
||||
#endif
|
||||
|
||||
vec4 material = packDepthToRGBA(fragmentDepth);
|
||||
#elif defined(dRenderVariant_marking)
|
||||
vec4 material;
|
||||
if(uMarkingType == 1) {
|
||||
@@ -51,7 +74,7 @@ export const assign_material_color = `
|
||||
discard;
|
||||
float depthTest = 1.0;
|
||||
if (uMarkingDepthTest) {
|
||||
depthTest = (fragmentDepth >= getDepth(gl_FragCoord.xy / uDrawingBufferSize)) ? 1.0 : 0.0;
|
||||
depthTest = (fragmentDepth >= getDepthPacked(gl_FragCoord.xy / uDrawingBufferSize)) ? 1.0 : 0.0;
|
||||
}
|
||||
bool isHighlight = intMod(marker, 2.0) > 0.1;
|
||||
float viewZ = depthToViewZ(uIsOrtho, fragmentDepth, uNear, uFar);
|
||||
@@ -62,47 +85,41 @@ export const assign_material_color = `
|
||||
}
|
||||
#endif
|
||||
|
||||
// apply screendoor transparency
|
||||
#if defined(dTransparency)
|
||||
// apply per-group transparency
|
||||
#if defined(dTransparency) && (defined(dRenderVariant_pick) || defined(dRenderVariant_color))
|
||||
float ta = 1.0 - vTransparency;
|
||||
#if defined(dRenderVariant_colorWboit)
|
||||
if (vTransparency < 0.2) ta = 1.0; // hard cutoff looks better with wboit
|
||||
#endif
|
||||
if (vTransparency < 0.2) ta = 1.0; // hard cutoff looks better
|
||||
|
||||
#if defined(dRenderVariant_pick)
|
||||
if (ta < uPickingAlphaThreshold)
|
||||
discard; // ignore so the element below can be picked
|
||||
#else
|
||||
#elif defined(dRenderVariant_color)
|
||||
material.a *= ta;
|
||||
|
||||
#if defined(dRenderVariant_colorBlended)
|
||||
float at = 0.0;
|
||||
|
||||
// shift by view-offset during multi-sample rendering to allow for blending
|
||||
vec2 coord = gl_FragCoord.xy + uViewOffset * 0.25;
|
||||
|
||||
const mat4 thresholdMatrix = mat4(
|
||||
1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,
|
||||
13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,
|
||||
4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,
|
||||
16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0
|
||||
);
|
||||
int ci = int(intMod(coord.x, 4.0));
|
||||
int ri = int(intMod(coord.y, 4.0));
|
||||
#if __VERSION__ == 100
|
||||
vec4 i = vec4(float(ci * 4 + ri));
|
||||
vec4 v = thresholdMatrix[0] * vec4(equal(i, vec4(0.0, 1.0, 2.0, 3.0))) +
|
||||
thresholdMatrix[1] * vec4(equal(i, vec4(4.0, 5.0, 6.0, 7.0))) +
|
||||
thresholdMatrix[2] * vec4(equal(i, vec4(8.0, 9.0, 10.0, 11.0))) +
|
||||
thresholdMatrix[3] * vec4(equal(i, vec4(12.0, 13.0, 14.0, 15.0)));
|
||||
at = v.x + v.y + v.z + v.w;
|
||||
#else
|
||||
at = thresholdMatrix[ci][ri];
|
||||
#if defined(dTransparentBackfaces_off)
|
||||
if ((uRenderMask == MaskOpaque && material.a < 1.0) ||
|
||||
(uRenderMask == MaskTransparent && material.a == 1.0) ||
|
||||
(interior && material.a < 1.0)
|
||||
) {
|
||||
discard;
|
||||
}
|
||||
#elif defined(dTransparentBackfaces_on)
|
||||
if ((uRenderMask == MaskOpaque && material.a < 1.0) ||
|
||||
(uRenderMask == MaskTransparent && material.a == 1.0)
|
||||
) {
|
||||
discard;
|
||||
}
|
||||
#elif defined(dTransparentBackfaces_opaque)
|
||||
if (interior) {
|
||||
material.a = 1.0;
|
||||
} else if (
|
||||
(uRenderMask == MaskOpaque && material.a < 1.0) ||
|
||||
(uRenderMask == MaskTransparent && material.a == 1.0)
|
||||
) {
|
||||
discard;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (ta < 0.99 && (ta < 0.01 || ta < at)) {
|
||||
discard;
|
||||
}
|
||||
#elif defined(dRenderVariant_colorWboit)
|
||||
material.a *= ta;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -2,6 +2,12 @@ export const check_picking_alpha = `
|
||||
float viewZ = depthToViewZ(uIsOrtho, fragmentDepth, uNear, uFar);
|
||||
float fogFactor = smoothstep(uFogNear, uFogFar, abs(viewZ));
|
||||
float alpha = (1.0 - fogFactor) * uAlpha;
|
||||
if (uAlpha < uPickingAlphaThreshold || alpha < 0.1)
|
||||
discard; // ignore so the element below can be picked
|
||||
// if not opaque enough ignore so the element below can be picked
|
||||
if (uAlpha < uPickingAlphaThreshold || alpha < 0.1) {
|
||||
#ifdef dTransparentBackfaces_opaque
|
||||
if (!interior) discard;
|
||||
#else
|
||||
discard;
|
||||
#endif
|
||||
}
|
||||
`;
|
||||
@@ -19,6 +19,8 @@ uniform float uBumpiness;
|
||||
uniform vec3 uColorGridDim;
|
||||
uniform vec4 uColorGridTransform;
|
||||
uniform sampler2D tColorGrid;
|
||||
#elif defined(dColorType_direct)
|
||||
varying vec4 vColor;
|
||||
#endif
|
||||
|
||||
#ifdef dUsePalette
|
||||
|
||||
@@ -64,17 +64,24 @@ uniform float uXrayEdgeFalloff;
|
||||
|
||||
uniform mat4 uProjection;
|
||||
|
||||
uniform bool uRenderWboit;
|
||||
uniform int uRenderMask;
|
||||
uniform bool uMarkingDepthTest;
|
||||
|
||||
uniform sampler2D tDepth;
|
||||
uniform vec2 uDrawingBufferSize;
|
||||
|
||||
float getDepth(const in vec2 coords) {
|
||||
// always packed due to merged depth from primitives and volumes
|
||||
float getDepthPacked(const in vec2 coords) {
|
||||
return unpackRGBAToDepth(texture2D(tDepth, coords));
|
||||
}
|
||||
|
||||
float getDepth(const in vec2 coords) {
|
||||
#ifdef depthTextureSupport
|
||||
return texture2D(tDepth, coords).r;
|
||||
#else
|
||||
return unpackRGBAToDepth(texture2D(tDepth, coords));
|
||||
#endif
|
||||
}
|
||||
|
||||
float calcDepth(const in vec3 pos) {
|
||||
vec2 clipZW = pos.z * uProjection[2].zw + uProjection[3].zw;
|
||||
return 0.5 + 0.5 * clipZW.x / clipZW.y;
|
||||
|
||||
@@ -17,6 +17,10 @@ export const common = `
|
||||
#define dColorType_varying
|
||||
#endif
|
||||
|
||||
#define MaskAll 0
|
||||
#define MaskOpaque 1
|
||||
#define MaskTransparent 2
|
||||
|
||||
//
|
||||
|
||||
#define PI 3.14159265
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2019-2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2019-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
* @author Áron Samuel Kovács <aron.kovacs@mail.muni.cz>
|
||||
@@ -7,13 +7,16 @@
|
||||
|
||||
export const wboit_write = `
|
||||
#if defined(dRenderVariant_colorWboit)
|
||||
if (!uRenderWboit) {
|
||||
if (uRenderMask == MaskOpaque) {
|
||||
if (preFogAlpha < 1.0) {
|
||||
discard;
|
||||
}
|
||||
} else if (uRenderWboit) {
|
||||
} else if (uRenderMask == MaskTransparent) {
|
||||
// the 'fragmentDepth > 0.99' check is to handle precision issues with packed depth
|
||||
if (preFogAlpha != 1.0 && !interior && (fragmentDepth < getDepth(gl_FragCoord.xy / uDrawingBufferSize) || fragmentDepth > 0.99)) {
|
||||
if (preFogAlpha != 1.0 && (fragmentDepth < getDepth(gl_FragCoord.xy / uDrawingBufferSize) || fragmentDepth > 0.99)) {
|
||||
#ifdef dTransparentBackfaces_off
|
||||
if (interior) discard;
|
||||
#endif
|
||||
float alpha = gl_FragColor.a;
|
||||
float wboitWeight = alpha * clamp(pow(1.0 - fragmentDepth, 2.0), 0.01, 1.0);
|
||||
gl_FragColor = vec4(gl_FragColor.rgb * alpha * wboitWeight, alpha);
|
||||
|
||||
@@ -72,12 +72,7 @@ uniform float uPickingAlphaThreshold;
|
||||
uniform bool uTransparentBackground;
|
||||
uniform float uXrayEdgeFalloff;
|
||||
|
||||
uniform float uInteriorDarkening;
|
||||
uniform bool uInteriorColorFlag;
|
||||
uniform vec3 uInteriorColor;
|
||||
|
||||
uniform bool uRenderWboit;
|
||||
uniform bool uDoubleSided;
|
||||
uniform int uRenderMask;
|
||||
|
||||
uniform float uNear;
|
||||
uniform float uFar;
|
||||
@@ -146,12 +141,7 @@ float transferFunction(float value) {
|
||||
|
||||
float getDepth(const in vec2 coords) {
|
||||
#ifdef depthTextureSupport
|
||||
if (!uRenderWboit) {
|
||||
// in case of opaque volumes (and depth texture support)
|
||||
return texture2D(tDepth, coords).r;
|
||||
} else {
|
||||
return unpackRGBAToDepth(texture2D(tDepth, coords));
|
||||
}
|
||||
return texture2D(tDepth, coords).r;
|
||||
#else
|
||||
return unpackRGBAToDepth(texture2D(tDepth, coords));
|
||||
#endif
|
||||
@@ -294,20 +284,24 @@ vec4 raymarch(vec3 startLoc, vec3 step, vec3 rayDir) {
|
||||
material.rgb = mix(material.rgb, overpaint.rgb, overpaint.a);
|
||||
#endif
|
||||
|
||||
if (material.a >= 0.01) {
|
||||
#ifdef dPackedGroup
|
||||
// compute gradient by central differences
|
||||
gradient.x = textureVal(unitPos - dx).a - textureVal(unitPos + dx).a;
|
||||
gradient.y = textureVal(unitPos - dy).a - textureVal(unitPos + dy).a;
|
||||
gradient.z = textureVal(unitPos - dz).a - textureVal(unitPos + dz).a;
|
||||
#else
|
||||
gradient = cell.xyz * 2.0 - 1.0;
|
||||
#endif
|
||||
vec3 normal = -normalize(normalMatrix * normalize(gradient));
|
||||
#include apply_light_color
|
||||
} else {
|
||||
#ifdef dIgnoreLight
|
||||
gl_FragColor.rgb = material.rgb;
|
||||
}
|
||||
#else
|
||||
if (material.a >= 0.01) {
|
||||
#ifdef dPackedGroup
|
||||
// compute gradient by central differences
|
||||
gradient.x = textureVal(unitPos - dx).a - textureVal(unitPos + dx).a;
|
||||
gradient.y = textureVal(unitPos - dy).a - textureVal(unitPos + dy).a;
|
||||
gradient.z = textureVal(unitPos - dz).a - textureVal(unitPos + dz).a;
|
||||
#else
|
||||
gradient = cell.xyz * 2.0 - 1.0;
|
||||
#endif
|
||||
vec3 normal = -normalize(normalMatrix * normalize(gradient));
|
||||
#include apply_light_color
|
||||
} else {
|
||||
gl_FragColor.rgb = material.rgb;
|
||||
}
|
||||
#endif
|
||||
|
||||
gl_FragColor.a = material.a * uAlpha * uTransferScale;
|
||||
|
||||
@@ -357,7 +351,6 @@ void main() {
|
||||
|
||||
float fragmentDepth = calcDepth((uModelView * vec4(start, 1.0)).xyz);
|
||||
float preFogAlpha = clamp(preFogAlphaBlended, 0.0, 1.0);
|
||||
bool interior = false;
|
||||
#include wboit_write
|
||||
}
|
||||
`;
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2020-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2020-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
*/
|
||||
@@ -99,7 +99,6 @@ void main() {
|
||||
if (imageData.a > 0.9) imageData.a = 1.0;
|
||||
|
||||
float fragmentDepth = gl_FragCoord.z;
|
||||
bool interior = false;
|
||||
|
||||
#if defined(dRenderVariant_pick)
|
||||
if (imageData.a < 0.3)
|
||||
@@ -131,7 +130,7 @@ void main() {
|
||||
discard;
|
||||
float depthTest = 1.0;
|
||||
if (uMarkingDepthTest) {
|
||||
depthTest = (fragmentDepth >= getDepth(gl_FragCoord.xy / uDrawingBufferSize)) ? 1.0 : 0.0;
|
||||
depthTest = (fragmentDepth >= getDepthPacked(gl_FragCoord.xy / uDrawingBufferSize)) ? 1.0 : 0.0;
|
||||
}
|
||||
bool isHighlight = intMod(marker, 2.0) > 0.1;
|
||||
gl_FragColor = vec4(0.0, depthTest, isHighlight ? 1.0 : 0.0, 1.0);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2018-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
*/
|
||||
@@ -16,7 +16,6 @@ precision highp int;
|
||||
void main(){
|
||||
#include clip_pixel
|
||||
|
||||
bool interior = false;
|
||||
float fragmentDepth = gl_FragCoord.z;
|
||||
#include assign_material_color
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/**
|
||||
* Copyright (c) 2019-2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2019-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* @author Áron Samuel Kovács <aron.kovacs@mail.muni.cz>
|
||||
@author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
*/
|
||||
|
||||
export const outlines_frag = `
|
||||
@@ -9,7 +10,8 @@ precision highp float;
|
||||
precision highp int;
|
||||
precision highp sampler2D;
|
||||
|
||||
uniform sampler2D tDepth;
|
||||
uniform sampler2D tDepthOpaque;
|
||||
uniform sampler2D tDepthTransparent;
|
||||
uniform vec2 uTexSize;
|
||||
|
||||
uniform float uNear;
|
||||
@@ -27,8 +29,16 @@ float getViewZ(const in float depth) {
|
||||
#endif
|
||||
}
|
||||
|
||||
float getDepth(const in vec2 coords) {
|
||||
return unpackRGBAToDepth(texture2D(tDepth, coords));
|
||||
float getDepthOpaque(const in vec2 coords) {
|
||||
#ifdef depthTextureSupport
|
||||
return texture2D(tDepthOpaque, coords).r;
|
||||
#else
|
||||
return unpackRGBAToDepth(texture2D(tDepthOpaque, coords));
|
||||
#endif
|
||||
}
|
||||
|
||||
float getDepthTransparent(const in vec2 coords) {
|
||||
return unpackRGBAToDepth(texture2D(tDepthTransparent, coords));
|
||||
}
|
||||
|
||||
bool isBackground(const in float depth) {
|
||||
@@ -41,8 +51,11 @@ void main(void) {
|
||||
vec2 coords = gl_FragCoord.xy / uTexSize;
|
||||
vec2 invTexSize = 1.0 / uTexSize;
|
||||
|
||||
float selfDepth = getDepth(coords);
|
||||
float selfViewZ = isBackground(selfDepth) ? backgroundViewZ : getViewZ(getDepth(coords));
|
||||
float selfDepthOpaque = getDepthOpaque(coords);
|
||||
float selfViewZOpaque = isBackground(selfDepthOpaque) ? backgroundViewZ : getViewZ(selfDepthOpaque);
|
||||
|
||||
float selfDepthTransparent = getDepthTransparent(coords);
|
||||
float selfViewZTransparent = isBackground(selfDepthTransparent) ? backgroundViewZ : getViewZ(selfDepthTransparent);
|
||||
|
||||
float outline = 1.0;
|
||||
float bestDepth = 1.0;
|
||||
@@ -50,12 +63,22 @@ void main(void) {
|
||||
for (int y = -1; y <= 1; y++) {
|
||||
for (int x = -1; x <= 1; x++) {
|
||||
vec2 sampleCoords = coords + vec2(float(x), float(y)) * invTexSize;
|
||||
float sampleDepth = getDepth(sampleCoords);
|
||||
float sampleViewZ = isBackground(sampleDepth) ? backgroundViewZ : getViewZ(sampleDepth);
|
||||
|
||||
if (abs(selfViewZ - sampleViewZ) > uMaxPossibleViewZDiff && selfDepth > sampleDepth && sampleDepth <= bestDepth) {
|
||||
float sampleDepthOpaque = getDepthOpaque(sampleCoords);
|
||||
float sampleDepthTransparent = getDepthTransparent(sampleCoords);
|
||||
|
||||
float sampleViewZOpaque = isBackground(sampleDepthOpaque) ? backgroundViewZ : getViewZ(sampleDepthOpaque);
|
||||
if (abs(selfViewZOpaque - sampleViewZOpaque) > uMaxPossibleViewZDiff && selfDepthOpaque > sampleDepthOpaque && sampleDepthOpaque <= bestDepth) {
|
||||
outline = 0.0;
|
||||
bestDepth = sampleDepth;
|
||||
bestDepth = sampleDepthOpaque;
|
||||
}
|
||||
|
||||
if (sampleDepthTransparent < sampleDepthOpaque) {
|
||||
float sampleViewZTransparent = isBackground(sampleDepthTransparent) ? backgroundViewZ : getViewZ(sampleDepthTransparent);
|
||||
if (abs(selfViewZTransparent - sampleViewZTransparent) > uMaxPossibleViewZDiff && selfDepthTransparent > sampleDepthTransparent && sampleDepthTransparent <= bestDepth) {
|
||||
outline = 0.0;
|
||||
bestDepth = sampleDepthTransparent;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2018-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
*/
|
||||
@@ -20,7 +20,6 @@ void main(){
|
||||
#include clip_pixel
|
||||
|
||||
float fragmentDepth = gl_FragCoord.z;
|
||||
bool interior = false;
|
||||
#include assign_material_color
|
||||
|
||||
#if defined(dPointStyle_circle)
|
||||
|
||||
@@ -12,7 +12,8 @@ precision highp sampler2D;
|
||||
|
||||
uniform sampler2D tSsaoDepth;
|
||||
uniform sampler2D tColor;
|
||||
uniform sampler2D tDepth;
|
||||
uniform sampler2D tDepthOpaque;
|
||||
uniform sampler2D tDepthTransparent;
|
||||
uniform sampler2D tOutlines;
|
||||
uniform vec2 uTexSize;
|
||||
|
||||
@@ -40,19 +41,27 @@ float getViewZ(const in float depth) {
|
||||
#endif
|
||||
}
|
||||
|
||||
float getDepth(const in vec2 coords) {
|
||||
return unpackRGBAToDepth(texture2D(tDepth, coords));
|
||||
float getDepthOpaque(const in vec2 coords) {
|
||||
#ifdef depthTextureSupport
|
||||
return texture2D(tDepthOpaque, coords).r;
|
||||
#else
|
||||
return unpackRGBAToDepth(texture2D(tDepthOpaque, coords));
|
||||
#endif
|
||||
}
|
||||
|
||||
float getDepthTransparent(const in vec2 coords) {
|
||||
return unpackRGBAToDepth(texture2D(tDepthTransparent, coords));
|
||||
}
|
||||
|
||||
bool isBackground(const in float depth) {
|
||||
return depth == 1.0;
|
||||
}
|
||||
|
||||
float getOutline(const in vec2 coords, out float closestTexel) {
|
||||
float getOutline(const in vec2 coords, const in float opaqueDepth, out float closestTexel) {
|
||||
float backgroundViewZ = uFar + 3.0 * uMaxPossibleViewZDiff;
|
||||
vec2 invTexSize = 1.0 / uTexSize;
|
||||
|
||||
float selfDepth = getDepth(coords);
|
||||
float selfDepth = min(opaqueDepth, getDepthTransparent(coords));
|
||||
float selfViewZ = isBackground(selfDepth) ? backgroundViewZ : getViewZ(selfDepth);
|
||||
|
||||
float outline = 1.0;
|
||||
@@ -68,14 +77,15 @@ float getOutline(const in vec2 coords, out float closestTexel) {
|
||||
vec4 sampleOutlineCombined = texture2D(tOutlines, sampleCoords);
|
||||
float sampleOutline = sampleOutlineCombined.r;
|
||||
float sampleOutlineDepth = unpackRGToUnitInterval(sampleOutlineCombined.gb);
|
||||
float sampleOutlineViewZ = isBackground(sampleOutlineDepth) ? backgroundViewZ : getViewZ(sampleOutlineDepth);
|
||||
|
||||
if (sampleOutline == 0.0 && sampleOutlineDepth < closestTexel && abs(selfViewZ - sampleOutlineDepth) > uMaxPossibleViewZDiff) {
|
||||
if (sampleOutline == 0.0 && sampleOutlineDepth < closestTexel && abs(selfViewZ - sampleOutlineViewZ) > uMaxPossibleViewZDiff) {
|
||||
outline = 0.0;
|
||||
closestTexel = sampleOutlineDepth;
|
||||
}
|
||||
}
|
||||
}
|
||||
return outline;
|
||||
return closestTexel < opaqueDepth ? outline : 1.0;
|
||||
}
|
||||
|
||||
float getSsao(vec2 coords) {
|
||||
@@ -95,11 +105,11 @@ void main(void) {
|
||||
|
||||
float viewDist;
|
||||
float fogFactor;
|
||||
float opaqueDepth = getDepthOpaque(coords);
|
||||
|
||||
#ifdef dOcclusionEnable
|
||||
float depth = getDepth(coords);
|
||||
if (!isBackground(depth)) {
|
||||
viewDist = abs(getViewZ(depth));
|
||||
if (!isBackground(opaqueDepth)) {
|
||||
viewDist = abs(getViewZ(opaqueDepth));
|
||||
fogFactor = smoothstep(uFogNear, uFogFar, viewDist);
|
||||
float occlusionFactor = getSsao(coords + uOcclusionOffset);
|
||||
if (!uTransparentBackground) {
|
||||
@@ -113,16 +123,15 @@ void main(void) {
|
||||
// outline needs to be handled after occlusion to keep them clean
|
||||
#ifdef dOutlineEnable
|
||||
float closestTexel;
|
||||
float outline = getOutline(coords, closestTexel);
|
||||
|
||||
float outline = getOutline(coords, opaqueDepth, closestTexel);
|
||||
if (outline == 0.0) {
|
||||
color.rgb = mix(uOutlineColor, color.rgb, outline);
|
||||
viewDist = abs(getViewZ(closestTexel));
|
||||
fogFactor = smoothstep(uFogNear, uFogFar, viewDist);
|
||||
if (!uTransparentBackground) {
|
||||
color.rgb = mix(color.rgb, uFogColor, fogFactor);
|
||||
color.rgb = mix(uOutlineColor, uFogColor, fogFactor);
|
||||
} else {
|
||||
color.a = 1.0 - fogFactor;
|
||||
color.rgb = mix(uOutlineColor, color.rgb, fogFactor);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2019-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2019-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
* @author Áron Samuel Kovács <aron.kovacs@mail.muni.cz>
|
||||
@@ -51,7 +51,15 @@ bool outsideBounds(const in vec2 p) {
|
||||
}
|
||||
|
||||
float getDepth(const in vec2 coords) {
|
||||
return outsideBounds(coords) ? 1.0 : unpackRGBAToDepth(texture2D(tDepth, coords));
|
||||
if (outsideBounds(coords)) {
|
||||
return 1.0;
|
||||
} else {
|
||||
#ifdef depthTextureSupport
|
||||
return texture2D(tDepth, coords).r;
|
||||
#else
|
||||
return unpackRGBAToDepth(texture2D(tDepth, coords));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
vec3 normalFromDepth(const in float depth, const in float depth1, const in float depth2, vec2 offset1, vec2 offset2) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2019-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2019-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
*/
|
||||
@@ -33,7 +33,6 @@ void main(){
|
||||
#include clip_pixel
|
||||
|
||||
float fragmentDepth = gl_FragCoord.z;
|
||||
bool interior = false;
|
||||
#include assign_material_color
|
||||
|
||||
if (vTexCoord.x > 1.0) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2018-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
*/
|
||||
@@ -9,7 +9,7 @@ import { ValueCell } from '../../mol-util';
|
||||
import { RenderableSchema } from '../renderable/schema';
|
||||
import { idFactory } from '../../mol-util/id-factory';
|
||||
import { assertUnreachable, ValueOf } from '../../mol-util/type-helpers';
|
||||
import { GLRenderingContext } from './compat';
|
||||
import { GLRenderingContext, isWebGL2 } from './compat';
|
||||
import { WebGLExtensions } from './extensions';
|
||||
import { WebGLState } from './state';
|
||||
|
||||
@@ -48,6 +48,7 @@ export function getDataType(gl: GLRenderingContext, dataType: DataType) {
|
||||
case 'uint32': return gl.UNSIGNED_INT;
|
||||
case 'int32': return gl.INT;
|
||||
case 'float32': return gl.FLOAT;
|
||||
default: assertUnreachable(dataType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +75,12 @@ export function getBufferType(gl: GLRenderingContext, bufferType: BufferType) {
|
||||
switch (bufferType) {
|
||||
case 'attribute': return gl.ARRAY_BUFFER;
|
||||
case 'elements': return gl.ELEMENT_ARRAY_BUFFER;
|
||||
case 'uniform': return (gl as WebGL2RenderingContext).UNIFORM_BUFFER;
|
||||
case 'uniform':
|
||||
if (isWebGL2(gl)) {
|
||||
return gl.UNIFORM_BUFFER;
|
||||
} else {
|
||||
throw new Error('WebGL2 is required for uniform buffers');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,18 +163,10 @@ function createBuffer(gl: GLRenderingContext, array: ArrayType, usageHint: Usage
|
||||
//
|
||||
|
||||
export type AttributeItemSize = 1 | 2 | 3 | 4 | 16
|
||||
export type AttributeKind = 'float32' | 'int32'
|
||||
export type AttributeKind = 'float32'
|
||||
|
||||
export function getAttribType(gl: GLRenderingContext, kind: AttributeKind, itemSize: AttributeItemSize) {
|
||||
switch (kind) {
|
||||
case 'int32':
|
||||
switch (itemSize) {
|
||||
case 1: return gl.INT;
|
||||
case 2: return gl.INT_VEC2;
|
||||
case 3: return gl.INT_VEC3;
|
||||
case 4: return gl.INT_VEC4;
|
||||
}
|
||||
break;
|
||||
case 'float32':
|
||||
switch (itemSize) {
|
||||
case 1: return gl.FLOAT;
|
||||
@@ -177,9 +175,9 @@ export function getAttribType(gl: GLRenderingContext, kind: AttributeKind, itemS
|
||||
case 4: return gl.FLOAT_VEC4;
|
||||
case 16: return gl.FLOAT_MAT4;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
assertUnreachable(kind);
|
||||
}
|
||||
throw new Error(`unknown attribute type for kind '${kind}' and itemSize '${itemSize}'`);
|
||||
}
|
||||
|
||||
export type AttributeDefs = {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2018-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
*/
|
||||
@@ -281,7 +281,7 @@ export function createContext(gl: GLRenderingContext, props: Partial<{ pixelScal
|
||||
gl,
|
||||
isWebGL2: isWebGL2(gl),
|
||||
get pixelRatio() {
|
||||
const dpr = (typeof window !== 'undefined') ? window.devicePixelRatio : 1;
|
||||
const dpr = (typeof window !== 'undefined') ? (window.devicePixelRatio || 1) : 1;
|
||||
return dpr * (props.pixelScale || 1);
|
||||
},
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2018-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
*/
|
||||
@@ -7,13 +7,13 @@
|
||||
import { ShaderCode, DefineValues, addShaderDefines } from '../shader-code';
|
||||
import { WebGLState } from './state';
|
||||
import { WebGLExtensions } from './extensions';
|
||||
import { getUniformSetters, UniformsList, getUniformType, UniformSetters } from './uniform';
|
||||
import { getUniformSetters, UniformsList, getUniformType, UniformSetters, isArrayUniform } from './uniform';
|
||||
import { AttributeBuffers, getAttribType } from './buffer';
|
||||
import { TextureId, Textures } from './texture';
|
||||
import { idFactory } from '../../mol-util/id-factory';
|
||||
import { RenderableSchema } from '../renderable/schema';
|
||||
import { isDebugMode } from '../../mol-util/debug';
|
||||
import { GLRenderingContext } from './compat';
|
||||
import { GLRenderingContext, isWebGL2 } from './compat';
|
||||
import { ShaderType, Shader } from './shader';
|
||||
|
||||
const getNextProgramId = idFactory();
|
||||
@@ -41,7 +41,14 @@ function getLocations(gl: GLRenderingContext, program: WebGLProgram, schema: Ren
|
||||
// unused attributes will result in a `-1` location which is usually fine
|
||||
// if (loc === -1) console.info(`Could not get attribute location for '${k}'`);
|
||||
locations[k] = loc;
|
||||
} else if (spec.type === 'uniform' || spec.type === 'texture') {
|
||||
} else if (spec.type === 'uniform') {
|
||||
let loc = gl.getUniformLocation(program, k);
|
||||
// headless-gl requires a '[0]' suffix for array uniforms (https://github.com/stackgl/headless-gl/issues/170)
|
||||
if (loc === null && isArrayUniform(spec.kind)) loc = gl.getUniformLocation(program, k + '[0]');
|
||||
// unused uniforms will result in a `null` location which is usually fine
|
||||
// if (loc === null) console.info(`Could not get uniform location for '${k}'`);
|
||||
locations[k] = loc as number;
|
||||
} else if (spec.type === 'texture') {
|
||||
const loc = gl.getUniformLocation(program, k);
|
||||
// unused uniforms will result in a `null` location which is usually fine
|
||||
// if (loc === null) console.info(`Could not get uniform location for '${k}'`);
|
||||
@@ -72,7 +79,7 @@ function checkActiveAttributes(gl: GLRenderingContext, program: WebGLProgram, sc
|
||||
}
|
||||
const attribType = getAttribType(gl, spec.kind, spec.itemSize);
|
||||
if (attribType !== type) {
|
||||
throw new Error(`unexpected attribute type for ${name}`);
|
||||
throw new Error(`unexpected attribute type '${attribType}' for ${name}, expected '${type}'`);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -104,8 +111,12 @@ function checkActiveUniforms(gl: GLRenderingContext, program: WebGLProgram, sche
|
||||
throw new Error(`unexpected sampler type for '${name}'`);
|
||||
}
|
||||
} else if (spec.kind === 'volume-float32' || spec.kind === 'volume-uint8') {
|
||||
if (type !== (gl as WebGL2RenderingContext).SAMPLER_3D) {
|
||||
throw new Error(`unexpected sampler type for '${name}'`);
|
||||
if (isWebGL2(gl)) {
|
||||
if (type !== gl.SAMPLER_3D) {
|
||||
throw new Error(`unexpected sampler type for '${name}'`);
|
||||
}
|
||||
} else {
|
||||
throw new Error(`WebGL2 is required to use SAMPLER_3D`);
|
||||
}
|
||||
} else {
|
||||
// TODO
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2018-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
*/
|
||||
@@ -9,6 +9,7 @@ import { createNullTexture, Texture, TextureFilter } from './texture';
|
||||
import { createNullFramebuffer, Framebuffer } from './framebuffer';
|
||||
import { WebGLResources } from './resources';
|
||||
import { GLRenderingContext, isWebGL2 } from './compat';
|
||||
import { Renderbuffer } from './renderbuffer';
|
||||
|
||||
const getNextRenderTargetId = idFactory();
|
||||
|
||||
@@ -16,6 +17,7 @@ export interface RenderTarget {
|
||||
readonly id: number
|
||||
readonly texture: Texture
|
||||
readonly framebuffer: Framebuffer
|
||||
readonly depthRenderbuffer: Renderbuffer | null
|
||||
|
||||
getWidth: () => number
|
||||
getHeight: () => number
|
||||
@@ -54,6 +56,7 @@ export function createRenderTarget(gl: GLRenderingContext, resources: WebGLResou
|
||||
id: getNextRenderTargetId(),
|
||||
texture: targetTexture,
|
||||
framebuffer,
|
||||
depthRenderbuffer,
|
||||
|
||||
getWidth: () => _width,
|
||||
getHeight: () => _height,
|
||||
@@ -90,6 +93,7 @@ export function createNullRenderTarget(gl: GLRenderingContext): RenderTarget {
|
||||
id: getNextRenderTargetId(),
|
||||
texture: createNullTexture(gl),
|
||||
framebuffer: createNullFramebuffer(),
|
||||
depthRenderbuffer: null,
|
||||
|
||||
getWidth: () => 0,
|
||||
getHeight: () => 0,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2018-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
*/
|
||||
@@ -40,6 +40,7 @@ export interface Renderbuffer {
|
||||
|
||||
bind: () => void
|
||||
attachFramebuffer: (framebuffer: Framebuffer) => void
|
||||
detachFramebuffer: (framebuffer: Framebuffer) => void
|
||||
setSize: (width: number, height: number) => void
|
||||
reset: () => void
|
||||
destroy: () => void
|
||||
@@ -78,6 +79,12 @@ export function createRenderbuffer(gl: GLRenderingContext, format: RenderbufferF
|
||||
gl.framebufferRenderbuffer(gl.FRAMEBUFFER, _attachment, gl.RENDERBUFFER, _renderbuffer);
|
||||
if (isDebugMode) checkFramebufferStatus(gl);
|
||||
},
|
||||
detachFramebuffer: (framebuffer: Framebuffer) => {
|
||||
framebuffer.bind();
|
||||
bind();
|
||||
gl.framebufferRenderbuffer(gl.FRAMEBUFFER, _attachment, gl.RENDERBUFFER, null);
|
||||
if (isDebugMode) checkFramebufferStatus(gl);
|
||||
},
|
||||
setSize: (width: number, height: number) => {
|
||||
_width = width;
|
||||
_height = height;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2018-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
*/
|
||||
@@ -44,6 +44,10 @@ export type WebGLState = {
|
||||
cullFace: (mode: number) => void
|
||||
/** sets whether writing into the depth buffer is enabled or disabled */
|
||||
depthMask: (flag: boolean) => void
|
||||
/** specifies the depth value used when clearing depth buffer, used when calling `gl.clear` */
|
||||
clearDepth: (depth: number) => void
|
||||
/** sets the depth comparison function */
|
||||
depthFunc: (func: number) => void
|
||||
/** sets which color components to enable or to disable */
|
||||
colorMask: (red: boolean, green: boolean, blue: boolean, alpha: boolean) => void
|
||||
/** specifies the color values used when clearing color buffers, used when calling `gl.clear`, clamped to [0, 1] */
|
||||
@@ -58,6 +62,8 @@ export type WebGLState = {
|
||||
blendEquation: (mode: number) => void
|
||||
/** set the RGB blend equation and alpha blend equation separately, determines how a new pixel is combined with an existing */
|
||||
blendEquationSeparate: (modeRGB: number, modeAlpha: number) => void
|
||||
/** specifies the source and destination blending factors, clamped to [0, 1] */
|
||||
blendColor: (red: number, green: number, blue: number, alpha: number) => void
|
||||
|
||||
enableVertexAttrib: (index: number) => void
|
||||
clearVertexAttribsState: () => void
|
||||
@@ -72,6 +78,8 @@ export function createState(gl: GLRenderingContext): WebGLState {
|
||||
let currentFrontFace = gl.getParameter(gl.FRONT_FACE);
|
||||
let currentCullFace = gl.getParameter(gl.CULL_FACE_MODE);
|
||||
let currentDepthMask = gl.getParameter(gl.DEPTH_WRITEMASK);
|
||||
let currentClearDepth = gl.getParameter(gl.DEPTH_CLEAR_VALUE);
|
||||
let currentDepthFunc = gl.getParameter(gl.DEPTH_FUNC);
|
||||
let currentColorMask = gl.getParameter(gl.COLOR_WRITEMASK);
|
||||
let currentClearColor = gl.getParameter(gl.COLOR_CLEAR_VALUE);
|
||||
|
||||
@@ -79,6 +87,7 @@ export function createState(gl: GLRenderingContext): WebGLState {
|
||||
let currentBlendDstRGB = gl.getParameter(gl.BLEND_DST_RGB);
|
||||
let currentBlendSrcAlpha = gl.getParameter(gl.BLEND_SRC_ALPHA);
|
||||
let currentBlendDstAlpha = gl.getParameter(gl.BLEND_DST_ALPHA);
|
||||
let currentBlendColor = gl.getParameter(gl.BLEND_COLOR);
|
||||
|
||||
let currentBlendEqRGB = gl.getParameter(gl.BLEND_EQUATION_RGB);
|
||||
let currentBlendEqAlpha = gl.getParameter(gl.BLEND_EQUATION_ALPHA);
|
||||
@@ -129,6 +138,18 @@ export function createState(gl: GLRenderingContext): WebGLState {
|
||||
currentDepthMask = flag;
|
||||
}
|
||||
},
|
||||
clearDepth: (depth: number) => {
|
||||
if (depth !== currentClearDepth) {
|
||||
gl.clearDepth(depth);
|
||||
currentClearDepth = depth;
|
||||
}
|
||||
},
|
||||
depthFunc: (func: number) => {
|
||||
if (func !== currentDepthFunc) {
|
||||
gl.depthFunc(func);
|
||||
currentDepthFunc = func;
|
||||
}
|
||||
},
|
||||
colorMask: (red: boolean, green: boolean, blue: boolean, alpha: boolean) => {
|
||||
if (red !== currentColorMask[0] || green !== currentColorMask[1] || blue !== currentColorMask[2] || alpha !== currentColorMask[3]) {
|
||||
gl.colorMask(red, green, blue, alpha);
|
||||
@@ -166,7 +187,6 @@ export function createState(gl: GLRenderingContext): WebGLState {
|
||||
currentBlendDstAlpha = dstAlpha;
|
||||
}
|
||||
},
|
||||
|
||||
blendEquation: (mode: number) => {
|
||||
if (mode !== currentBlendEqRGB || mode !== currentBlendEqAlpha) {
|
||||
gl.blendEquation(mode);
|
||||
@@ -181,6 +201,15 @@ export function createState(gl: GLRenderingContext): WebGLState {
|
||||
currentBlendEqAlpha = modeAlpha;
|
||||
}
|
||||
},
|
||||
blendColor: (red: number, green: number, blue: number, alpha: number) => {
|
||||
if (red !== currentBlendColor[0] || green !== currentBlendColor[1] || blue !== currentBlendColor[2] || alpha !== currentBlendColor[3]) {
|
||||
gl.blendColor(red, green, blue, alpha);
|
||||
currentBlendColor[0] = red;
|
||||
currentBlendColor[1] = green;
|
||||
currentBlendColor[2] = blue;
|
||||
currentBlendColor[3] = alpha;
|
||||
}
|
||||
},
|
||||
|
||||
enableVertexAttrib: (index: number) => {
|
||||
gl.enableVertexAttribArray(index);
|
||||
@@ -199,6 +228,8 @@ export function createState(gl: GLRenderingContext): WebGLState {
|
||||
currentFrontFace = gl.getParameter(gl.FRONT_FACE);
|
||||
currentCullFace = gl.getParameter(gl.CULL_FACE_MODE);
|
||||
currentDepthMask = gl.getParameter(gl.DEPTH_WRITEMASK);
|
||||
currentClearDepth = gl.getParameter(gl.DEPTH_CLEAR_VALUE);
|
||||
currentDepthFunc = gl.getParameter(gl.DEPTH_FUNC);
|
||||
currentColorMask = gl.getParameter(gl.COLOR_WRITEMASK);
|
||||
currentClearColor = gl.getParameter(gl.COLOR_CLEAR_VALUE);
|
||||
|
||||
@@ -206,6 +237,7 @@ export function createState(gl: GLRenderingContext): WebGLState {
|
||||
currentBlendDstRGB = gl.getParameter(gl.BLEND_DST_RGB);
|
||||
currentBlendSrcAlpha = gl.getParameter(gl.BLEND_SRC_ALPHA);
|
||||
currentBlendDstAlpha = gl.getParameter(gl.BLEND_DST_ALPHA);
|
||||
currentBlendColor = gl.getParameter(gl.BLEND_COLOR);
|
||||
|
||||
currentBlendEqRGB = gl.getParameter(gl.BLEND_EQUATION_RGB);
|
||||
currentBlendEqAlpha = gl.getParameter(gl.BLEND_EQUATION_ALPHA);
|
||||
|
||||
@@ -238,6 +238,10 @@ export function createTexture(gl: GLRenderingContext, extensions: WebGLExtension
|
||||
throw new Error(`texture kind '${kind}' and type '${_type}' are incompatible`);
|
||||
}
|
||||
|
||||
if (!extensions.depthTexture && _format === 'depth') {
|
||||
throw new Error(`extension 'WEBGL_depth_texture' needed for 'depth' texture format`);
|
||||
}
|
||||
|
||||
const target = getTarget(gl, kind);
|
||||
const filter = getFilter(gl, _filter);
|
||||
const format = getFormat(gl, _format, _type);
|
||||
|
||||
@@ -42,6 +42,10 @@ export function getUniformType(gl: GLRenderingContext, kind: UniformKind) {
|
||||
}
|
||||
}
|
||||
|
||||
export function isArrayUniform(kind: UniformKind) {
|
||||
return kind.endsWith('[]');
|
||||
}
|
||||
|
||||
export type UniformSetter = (gl: GLRenderingContext, location: number, value: any) => void
|
||||
export type UniformSetters = { [k: string]: UniformSetter }
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2017-2019 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2017-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* @author David Sehnal <david.sehnal@gmail.com>
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
@@ -45,7 +45,7 @@ type ColumnCtor = (field: Data.CifField, category: Data.CifCategory, key: string
|
||||
|
||||
function getColumnCtor(t: Column.Schema): ColumnCtor {
|
||||
switch (t.valueType) {
|
||||
case 'str': return (f, c, k) => createColumn(t, f, f.str, f.toStringArray);
|
||||
case 'str': return (f, c, k) => createStringColumn(t, f, f.str, f.toStringArray);
|
||||
case 'int': return (f, c, k) => createColumn(t, f, f.int, f.toIntArray);
|
||||
case 'float': return (f, c, k) => createColumn(t, f, f.float, f.toFloatArray);
|
||||
case 'list': throw new Error('Use createListColumn instead.');
|
||||
@@ -53,6 +53,27 @@ function getColumnCtor(t: Column.Schema): ColumnCtor {
|
||||
}
|
||||
}
|
||||
|
||||
function createStringColumn<T extends string>(schema: Column.Schema.Str | Column.Schema.Aliased<T>, field: Data.CifField, value: (row: number) => T, toArray: Column<T>['toArray']): Column<T> {
|
||||
return {
|
||||
schema,
|
||||
__array: field.__array,
|
||||
isDefined: field.isDefined,
|
||||
rowCount: field.rowCount,
|
||||
value: schema.transform === 'lowercase'
|
||||
? row => value(row).toLowerCase() as T
|
||||
: schema.transform === 'uppercase'
|
||||
? row => value(row).toUpperCase() as T
|
||||
: value,
|
||||
valueKind: field.valueKind,
|
||||
areValuesEqual: field.areValuesEqual,
|
||||
toArray: schema.transform === 'lowercase'
|
||||
? p => Array.from(toArray(p)).map(x => x.toLowerCase() as T)
|
||||
: schema.transform === 'uppercase'
|
||||
? p => Array.from(toArray(p)).map(x => x.toUpperCase() as T)
|
||||
: toArray,
|
||||
};
|
||||
}
|
||||
|
||||
function createColumn<T>(schema: Column.Schema, field: Data.CifField, value: (row: number) => T, toArray: Column<T>['toArray']): Column<T> {
|
||||
return {
|
||||
schema,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Copyright (c) 2017-2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2017-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* Code-generated 'BIRD' schema file. Dictionary versions: mmCIF 5.356, IHM 1.17, MA 1.3.5.
|
||||
* Code-generated 'BIRD' schema file. Dictionary versions: mmCIF 5.358, IHM 1.17, MA 1.4.0.
|
||||
*
|
||||
* @author molstar/ciftools package
|
||||
*/
|
||||
@@ -12,6 +12,7 @@ import Schema = Column.Schema;
|
||||
|
||||
const str = Schema.str;
|
||||
const float = Schema.float;
|
||||
const lstr = Schema.lstr;
|
||||
const Aliased = Schema.Aliased;
|
||||
const int = Schema.int;
|
||||
|
||||
@@ -58,7 +59,7 @@ export const BIRD_Schema = {
|
||||
/**
|
||||
* Defines the structural classification of the entity.
|
||||
*/
|
||||
type: Aliased<'Amino acid' | 'Aminoglycoside' | 'Anthracycline' | 'Anthraquinone' | 'Ansamycin' | 'Chalkophore' | 'Chromophore' | 'Glycopeptide' | 'Cyclic depsipeptide' | 'Cyclic lipopeptide' | 'Cyclic peptide' | 'Heterocyclic' | 'Imino sugar' | 'Keto acid' | 'Lipoglycopeptide' | 'Lipopeptide' | 'Macrolide' | 'Non-polymer' | 'Nucleoside' | 'Oligopeptide' | 'Oligosaccharide' | 'Peptaibol' | 'Peptide-like' | 'Polycyclic' | 'Polypeptide' | 'Polysaccharide' | 'Quinolone' | 'Thiolactone' | 'Thiopeptide' | 'Siderophore' | 'Unknown' | 'Chalkophore, Polypeptide'>(str),
|
||||
type: Aliased<'amino acid' | 'aminoglycoside' | 'anthracycline' | 'anthraquinone' | 'ansamycin' | 'chalkophore' | 'chromophore' | 'glycopeptide' | 'cyclic depsipeptide' | 'cyclic lipopeptide' | 'cyclic peptide' | 'heterocyclic' | 'imino sugar' | 'keto acid' | 'lipoglycopeptide' | 'lipopeptide' | 'macrolide' | 'non-polymer' | 'nucleoside' | 'oligopeptide' | 'oligosaccharide' | 'peptaibol' | 'peptide-like' | 'polycyclic' | 'polypeptide' | 'polysaccharide' | 'quinolone' | 'thiolactone' | 'thiopeptide' | 'siderophore' | 'unknown' | 'chalkophore, polypeptide'>(lstr),
|
||||
/**
|
||||
* Evidence for the assignment of _pdbx_reference_molecule.type
|
||||
*/
|
||||
@@ -66,7 +67,7 @@ export const BIRD_Schema = {
|
||||
/**
|
||||
* Broadly defines the function of the entity.
|
||||
*/
|
||||
class: Aliased<'Antagonist' | 'Antibiotic' | 'Anticancer' | 'Anticoagulant' | 'Antifungal' | 'Antigen' | 'Antiinflammatory' | 'Antimicrobial' | 'Antineoplastic' | 'Antiparasitic' | 'Antiretroviral' | 'Anthelmintic' | 'Antithrombotic' | 'Antitumor' | 'Antiviral' | 'CASPASE inhibitor' | 'Chaperone binding' | 'Enzyme inhibitor' | 'Drug delivery' | 'Glycan component' | 'Growth factor' | 'Immunosuppressant' | 'Inducer' | 'Inhibitor' | 'Lantibiotic' | 'Metabolism' | 'Metal transport' | 'Nutrient' | 'Oxidation-reduction' | 'Protein binding' | 'Receptor' | 'Substrate analog' | 'Synthetic opioid' | 'Thrombin inhibitor' | 'Transition state mimetic' | 'Transport activator' | 'Trypsin inhibitor' | 'Toxin' | 'Unknown' | 'Water retention' | 'Anticoagulant, Antithrombotic' | 'Antibiotic, Antimicrobial' | 'Antibiotic, Anthelmintic' | 'Antibiotic, Antineoplastic' | 'Antimicrobial, Antiretroviral' | 'Antimicrobial, Antitumor' | 'Antimicrobial, Antiparasitic, Antibiotic' | 'Thrombin inhibitor, Trypsin inhibitor'>(str),
|
||||
class: Aliased<'antagonist' | 'antibiotic' | 'anticancer' | 'anticoagulant' | 'antifungal' | 'antigen' | 'antiinflammatory' | 'antimicrobial' | 'antineoplastic' | 'antiparasitic' | 'antiretroviral' | 'anthelmintic' | 'antithrombotic' | 'antitumor' | 'antiviral' | 'caspase inhibitor' | 'chaperone binding' | 'enzyme inhibitor' | 'drug delivery' | 'glycan component' | 'growth factor' | 'immunosuppressant' | 'inducer' | 'inhibitor' | 'lantibiotic' | 'metabolism' | 'metal transport' | 'nutrient' | 'oxidation-reduction' | 'protein binding' | 'receptor' | 'substrate analog' | 'synthetic opioid' | 'thrombin inhibitor' | 'transition state mimetic' | 'transport activator' | 'trypsin inhibitor' | 'toxin' | 'unknown' | 'water retention' | 'anticoagulant, antithrombotic' | 'antibiotic, antimicrobial' | 'antibiotic, anthelmintic' | 'antibiotic, antineoplastic' | 'antimicrobial, antiretroviral' | 'antimicrobial, antitumor' | 'antimicrobial, antiparasitic, antibiotic' | 'thrombin inhibitor, trypsin inhibitor'>(lstr),
|
||||
/**
|
||||
* Evidence for the assignment of _pdbx_reference_molecule.class
|
||||
*/
|
||||
@@ -78,7 +79,7 @@ export const BIRD_Schema = {
|
||||
/**
|
||||
* Defines how this entity is represented in PDB data files.
|
||||
*/
|
||||
represent_as: Aliased<'polymer' | 'single molecule' | 'branched'>(str),
|
||||
represent_as: Aliased<'polymer' | 'single molecule' | 'branched'>(lstr),
|
||||
/**
|
||||
* For entities represented as single molecules, the identifier
|
||||
* corresponding to the chemical definition for the molecule.
|
||||
@@ -99,7 +100,7 @@ export const BIRD_Schema = {
|
||||
/**
|
||||
* Defines the current PDB release status for this molecule definition.
|
||||
*/
|
||||
release_status: Aliased<'REL' | 'HOLD' | 'OBS' | 'WAIT'>(str),
|
||||
release_status: Aliased<'rel' | 'hold' | 'obs' | 'wait'>(lstr),
|
||||
/**
|
||||
* Assigns the identifier for the reference molecule which have been replaced
|
||||
* by this reference molecule.
|
||||
@@ -129,7 +130,7 @@ export const BIRD_Schema = {
|
||||
/**
|
||||
* Defines the polymer characteristic of the entity.
|
||||
*/
|
||||
type: Aliased<'polymer' | 'polymer-like' | 'non-polymer' | 'branched'>(str),
|
||||
type: Aliased<'polymer' | 'polymer-like' | 'non-polymer' | 'branched'>(lstr),
|
||||
/**
|
||||
* Additional details about this entity.
|
||||
*/
|
||||
@@ -249,7 +250,7 @@ export const BIRD_Schema = {
|
||||
/**
|
||||
* The bond order target for the chemical linkage.
|
||||
*/
|
||||
value_order: Aliased<'sing' | 'doub' | 'trip' | 'quad' | 'arom' | 'poly' | 'delo' | 'pi'>(str),
|
||||
value_order: Aliased<'sing' | 'doub' | 'trip' | 'quad' | 'arom' | 'poly' | 'delo' | 'pi'>(lstr),
|
||||
/**
|
||||
* The entity component identifier for the first of two entities containing the linkage.
|
||||
*/
|
||||
@@ -335,7 +336,7 @@ export const BIRD_Schema = {
|
||||
/**
|
||||
* The bond order target for the non-standard linkage.
|
||||
*/
|
||||
value_order: Aliased<'sing' | 'doub' | 'trip' | 'quad' | 'arom' | 'poly' | 'delo' | 'pi'>(str),
|
||||
value_order: Aliased<'sing' | 'doub' | 'trip' | 'quad' | 'arom' | 'poly' | 'delo' | 'pi'>(lstr),
|
||||
},
|
||||
/**
|
||||
* Data items in the PDBX_REFERENCE_ENTITY_POLY category record details about
|
||||
@@ -400,11 +401,11 @@ export const BIRD_Schema = {
|
||||
/**
|
||||
* A flag to indicate that this monomer is observed in the instance example.
|
||||
*/
|
||||
observed: Aliased<'Y' | 'N'>(str),
|
||||
observed: Aliased<'y' | 'n'>(lstr),
|
||||
/**
|
||||
* A flag to indicate that sequence heterogeneity at this monomer position.
|
||||
*/
|
||||
hetero: Aliased<'Y' | 'N'>(str),
|
||||
hetero: Aliased<'y' | 'n'>(lstr),
|
||||
},
|
||||
/**
|
||||
* Additional features associated with the reference entity.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Copyright (c) 2017-2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2017-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* Code-generated 'CCD' schema file. Dictionary versions: mmCIF 5.356, IHM 1.17, MA 1.3.5.
|
||||
* Code-generated 'CCD' schema file. Dictionary versions: mmCIF 5.358, IHM 1.17, MA 1.4.0.
|
||||
*
|
||||
* @author molstar/ciftools package
|
||||
*/
|
||||
@@ -13,6 +13,7 @@ import Schema = Column.Schema;
|
||||
const str = Schema.str;
|
||||
const float = Schema.float;
|
||||
const List = Schema.List;
|
||||
const lstr = Schema.lstr;
|
||||
const Aliased = Schema.Aliased;
|
||||
const int = Schema.int;
|
||||
const coord = Schema.coord;
|
||||
@@ -103,7 +104,7 @@ export const CCD_Schema = {
|
||||
* linking monomers, monomers with some type of N-terminal (or 5')
|
||||
* cap and monomers with some type of C-terminal (or 3') cap.
|
||||
*/
|
||||
type: Aliased<'D-peptide linking' | 'L-peptide linking' | 'D-peptide NH3 amino terminus' | 'L-peptide NH3 amino terminus' | 'D-peptide COOH carboxy terminus' | 'L-peptide COOH carboxy terminus' | 'DNA linking' | 'RNA linking' | 'L-RNA linking' | 'L-DNA linking' | 'DNA OH 5 prime terminus' | 'RNA OH 5 prime terminus' | 'DNA OH 3 prime terminus' | 'RNA OH 3 prime terminus' | 'D-saccharide, beta linking' | 'D-saccharide, alpha linking' | 'L-saccharide, beta linking' | 'L-saccharide, alpha linking' | 'L-saccharide' | 'D-saccharide' | 'saccharide' | 'non-polymer' | 'peptide linking' | 'peptide-like' | 'L-gamma-peptide, C-delta linking' | 'D-gamma-peptide, C-delta linking' | 'L-beta-peptide, C-gamma linking' | 'D-beta-peptide, C-gamma linking' | 'other'>(str),
|
||||
type: Aliased<'d-peptide linking' | 'l-peptide linking' | 'd-peptide nh3 amino terminus' | 'l-peptide nh3 amino terminus' | 'd-peptide cooh carboxy terminus' | 'l-peptide cooh carboxy terminus' | 'dna linking' | 'rna linking' | 'l-rna linking' | 'l-dna linking' | 'dna oh 5 prime terminus' | 'rna oh 5 prime terminus' | 'dna oh 3 prime terminus' | 'rna oh 3 prime terminus' | 'd-saccharide, beta linking' | 'd-saccharide, alpha linking' | 'l-saccharide, beta linking' | 'l-saccharide, alpha linking' | 'l-saccharide' | 'd-saccharide' | 'saccharide' | 'non-polymer' | 'peptide linking' | 'peptide-like' | 'l-gamma-peptide, c-delta linking' | 'd-gamma-peptide, c-delta linking' | 'l-beta-peptide, c-gamma linking' | 'd-beta-peptide, c-gamma linking' | 'other'>(lstr),
|
||||
/**
|
||||
* Synonym list for the component.
|
||||
*/
|
||||
@@ -154,11 +155,11 @@ export const CCD_Schema = {
|
||||
/**
|
||||
* This data item identifies if ideal coordinates are missing in this definition.
|
||||
*/
|
||||
pdbx_ideal_coordinates_missing_flag: Aliased<'Y' | 'N'>(str),
|
||||
pdbx_ideal_coordinates_missing_flag: Aliased<'y' | 'n'>(lstr),
|
||||
/**
|
||||
* This data item identifies if model coordinates are missing in this definition.
|
||||
*/
|
||||
pdbx_model_coordinates_missing_flag: Aliased<'Y' | 'N'>(str),
|
||||
pdbx_model_coordinates_missing_flag: Aliased<'y' | 'n'>(lstr),
|
||||
/**
|
||||
* Date component was added to database.
|
||||
*/
|
||||
@@ -279,15 +280,15 @@ export const CCD_Schema = {
|
||||
/**
|
||||
* The chiral configuration of the atom that is a chiral center.
|
||||
*/
|
||||
pdbx_stereo_config: Aliased<'R' | 'S' | 'N'>(str),
|
||||
pdbx_stereo_config: Aliased<'r' | 's' | 'n'>(lstr),
|
||||
/**
|
||||
* A flag indicating an aromatic atom.
|
||||
*/
|
||||
pdbx_aromatic_flag: Aliased<'Y' | 'N'>(str),
|
||||
pdbx_aromatic_flag: Aliased<'y' | 'n'>(lstr),
|
||||
/**
|
||||
* A flag indicating a leaving atom.
|
||||
*/
|
||||
pdbx_leaving_atom_flag: Aliased<'Y' | 'N'>(str),
|
||||
pdbx_leaving_atom_flag: Aliased<'y' | 'n'>(lstr),
|
||||
},
|
||||
/**
|
||||
* Data items in the CHEM_COMP_BOND category record details about
|
||||
@@ -320,7 +321,7 @@ export const CCD_Schema = {
|
||||
* bond associated with the specified atoms, expressed as a bond
|
||||
* order.
|
||||
*/
|
||||
value_order: Aliased<'sing' | 'doub' | 'trip' | 'quad' | 'arom' | 'poly' | 'delo' | 'pi'>(str),
|
||||
value_order: Aliased<'sing' | 'doub' | 'trip' | 'quad' | 'arom' | 'poly' | 'delo' | 'pi'>(lstr),
|
||||
/**
|
||||
* Ordinal index for the component bond list.
|
||||
*/
|
||||
@@ -328,11 +329,11 @@ export const CCD_Schema = {
|
||||
/**
|
||||
* Stereochemical configuration across a double bond.
|
||||
*/
|
||||
pdbx_stereo_config: Aliased<'E' | 'Z' | 'N'>(str),
|
||||
pdbx_stereo_config: Aliased<'e' | 'z' | 'n'>(lstr),
|
||||
/**
|
||||
* A flag indicating an aromatic bond.
|
||||
*/
|
||||
pdbx_aromatic_flag: Aliased<'Y' | 'N'>(str),
|
||||
pdbx_aromatic_flag: Aliased<'y' | 'n'>(lstr),
|
||||
},
|
||||
/**
|
||||
* Data items in the CHEM_COMP_DESCRIPTOR category provide
|
||||
@@ -352,7 +353,7 @@ export const CCD_Schema = {
|
||||
/**
|
||||
* This data item contains the descriptor type.
|
||||
*/
|
||||
type: Aliased<'SMILES_CANNONICAL' | 'SMILES_CANONICAL' | 'SMILES' | 'InChI' | 'InChI_MAIN' | 'InChI_MAIN_FORMULA' | 'InChI_MAIN_CONNECT' | 'InChI_MAIN_HATOM' | 'InChI_CHARGE' | 'InChI_STEREO' | 'InChI_ISOTOPE' | 'InChI_FIXEDH' | 'InChI_RECONNECT' | 'InChIKey'>(str),
|
||||
type: Aliased<'smiles_cannonical' | 'smiles_canonical' | 'smiles' | 'inchi' | 'inchi_main' | 'inchi_main_formula' | 'inchi_main_connect' | 'inchi_main_hatom' | 'inchi_charge' | 'inchi_stereo' | 'inchi_isotope' | 'inchi_fixedh' | 'inchi_reconnect' | 'inchikey'>(lstr),
|
||||
/**
|
||||
* This data item contains the name of the program
|
||||
* or library used to compute the descriptor.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2017-2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2017-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* Code-generated 'CifCore' schema file. Dictionary versions: CifCore 3.1.0.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2018-2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* @author David Sehnal <david.sehnal@gmail.com>
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
@@ -25,9 +25,9 @@ export const mmCIF_chemCompBond_schema = {
|
||||
molstar_protonation_variant: Column.Schema.Str()
|
||||
};
|
||||
|
||||
/** Has `type` extended with 'Ion' and 'Lipid' */
|
||||
/** Has `type` extended with 'ION' and 'LIPID' */
|
||||
export const mmCIF_chemComp_schema = {
|
||||
...mmCIF_Schema.chem_comp,
|
||||
type: Column.Schema.Aliased<mmCIF_Schema['chem_comp']['type']['T'] | 'Ion' | 'Lipid'>(Column.Schema.str)
|
||||
type: Column.Schema.Aliased<mmCIF_Schema['chem_comp']['type']['T'] | 'ion' | 'lipid'>(Column.Schema.str)
|
||||
};
|
||||
export type mmCIF_chemComp_schema = typeof mmCIF_chemComp_schema;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Copyright (c) 2017-2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2017-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* Code-generated 'mmCIF' schema file. Dictionary versions: mmCIF 5.356, IHM 1.17, MA 1.3.5.
|
||||
* Code-generated 'mmCIF' schema file. Dictionary versions: mmCIF 5.358, IHM 1.17, MA 1.4.0.
|
||||
*
|
||||
* @author molstar/ciftools package
|
||||
*/
|
||||
@@ -17,6 +17,7 @@ const coord = Schema.coord;
|
||||
const Aliased = Schema.Aliased;
|
||||
const Matrix = Schema.Matrix;
|
||||
const Vector = Schema.Vector;
|
||||
const lstr = Schema.lstr;
|
||||
const List = Schema.List;
|
||||
|
||||
export const mmCIF_Schema = {
|
||||
@@ -512,7 +513,7 @@ export const mmCIF_Schema = {
|
||||
* _chem_comp.mon_nstd_parent, _chem_comp.mon_nstd_class and
|
||||
* _chem_comp.mon_nstd_details data items.
|
||||
*/
|
||||
mon_nstd_flag: Aliased<'no' | 'n' | 'yes' | 'y'>(str),
|
||||
mon_nstd_flag: Aliased<'no' | 'n' | 'yes' | 'y'>(lstr),
|
||||
/**
|
||||
* The full name of the component.
|
||||
*/
|
||||
@@ -523,7 +524,7 @@ export const mmCIF_Schema = {
|
||||
* linking monomers, monomers with some type of N-terminal (or 5')
|
||||
* cap and monomers with some type of C-terminal (or 3') cap.
|
||||
*/
|
||||
type: Aliased<'D-peptide linking' | 'L-peptide linking' | 'D-peptide NH3 amino terminus' | 'L-peptide NH3 amino terminus' | 'D-peptide COOH carboxy terminus' | 'L-peptide COOH carboxy terminus' | 'DNA linking' | 'RNA linking' | 'L-RNA linking' | 'L-DNA linking' | 'DNA OH 5 prime terminus' | 'RNA OH 5 prime terminus' | 'DNA OH 3 prime terminus' | 'RNA OH 3 prime terminus' | 'D-saccharide, beta linking' | 'D-saccharide, alpha linking' | 'L-saccharide, beta linking' | 'L-saccharide, alpha linking' | 'L-saccharide' | 'D-saccharide' | 'saccharide' | 'non-polymer' | 'peptide linking' | 'peptide-like' | 'L-gamma-peptide, C-delta linking' | 'D-gamma-peptide, C-delta linking' | 'L-beta-peptide, C-gamma linking' | 'D-beta-peptide, C-gamma linking' | 'other'>(str),
|
||||
type: Aliased<'d-peptide linking' | 'l-peptide linking' | 'd-peptide nh3 amino terminus' | 'l-peptide nh3 amino terminus' | 'd-peptide cooh carboxy terminus' | 'l-peptide cooh carboxy terminus' | 'dna linking' | 'rna linking' | 'l-rna linking' | 'l-dna linking' | 'dna oh 5 prime terminus' | 'rna oh 5 prime terminus' | 'dna oh 3 prime terminus' | 'rna oh 3 prime terminus' | 'd-saccharide, beta linking' | 'd-saccharide, alpha linking' | 'l-saccharide, beta linking' | 'l-saccharide, alpha linking' | 'l-saccharide' | 'd-saccharide' | 'saccharide' | 'non-polymer' | 'peptide linking' | 'peptide-like' | 'l-gamma-peptide, c-delta linking' | 'd-gamma-peptide, c-delta linking' | 'l-beta-peptide, c-gamma linking' | 'd-beta-peptide, c-gamma linking' | 'other'>(lstr),
|
||||
/**
|
||||
* Synonym list for the component.
|
||||
*/
|
||||
@@ -560,7 +561,7 @@ export const mmCIF_Schema = {
|
||||
* bond associated with the specified atoms, expressed as a bond
|
||||
* order.
|
||||
*/
|
||||
value_order: Aliased<'sing' | 'doub' | 'trip' | 'quad' | 'arom' | 'poly' | 'delo' | 'pi'>(str),
|
||||
value_order: Aliased<'sing' | 'doub' | 'trip' | 'quad' | 'arom' | 'poly' | 'delo' | 'pi'>(lstr),
|
||||
/**
|
||||
* Ordinal index for the component bond list.
|
||||
*/
|
||||
@@ -568,11 +569,11 @@ export const mmCIF_Schema = {
|
||||
/**
|
||||
* Stereochemical configuration across a double bond.
|
||||
*/
|
||||
pdbx_stereo_config: Aliased<'E' | 'Z' | 'N'>(str),
|
||||
pdbx_stereo_config: Aliased<'e' | 'z' | 'n'>(lstr),
|
||||
/**
|
||||
* A flag indicating an aromatic bond.
|
||||
*/
|
||||
pdbx_aromatic_flag: Aliased<'Y' | 'N'>(str),
|
||||
pdbx_aromatic_flag: Aliased<'y' | 'n'>(lstr),
|
||||
},
|
||||
/**
|
||||
* Data items in the CITATION category record details about the
|
||||
@@ -704,7 +705,7 @@ export const mmCIF_Schema = {
|
||||
/**
|
||||
* An abbreviation that identifies the database.
|
||||
*/
|
||||
database_id: Aliased<'AlphaFoldDB' | 'CAS' | 'CSD' | 'EMDB' | 'ICSD' | 'ModelArchive' | 'MDF' | 'MODBASE' | 'NDB' | 'NBS' | 'PDB' | 'PDF' | 'RCSB' | 'SWISS-MODEL_REPOSITORY' | 'EBI' | 'PDBE' | 'BMRB' | 'WWPDB' | 'PDB_ACC'>(str),
|
||||
database_id: Aliased<'alphafolddb' | 'cas' | 'csd' | 'emdb' | 'icsd' | 'modelarchive' | 'mdf' | 'modbase' | 'ndb' | 'nbs' | 'pdb' | 'pdf' | 'rcsb' | 'swiss-model_repository' | 'ebi' | 'pdbe' | 'bmrb' | 'wwpdb' | 'pdb_acc'>(lstr),
|
||||
/**
|
||||
* The code assigned by the database identified in
|
||||
* _database_2.database_id.
|
||||
@@ -767,7 +768,7 @@ export const mmCIF_Schema = {
|
||||
* manipulated sources are expected to have further information in
|
||||
* the ENTITY_SRC_GEN category.
|
||||
*/
|
||||
src_method: Aliased<'nat' | 'man' | 'syn'>(str),
|
||||
src_method: Aliased<'nat' | 'man' | 'syn'>(lstr),
|
||||
/**
|
||||
* Defines the type of the entity.
|
||||
*
|
||||
@@ -780,7 +781,7 @@ export const mmCIF_Schema = {
|
||||
* Water entities are not expected to have corresponding
|
||||
* entries in the ENTITY category.
|
||||
*/
|
||||
type: Aliased<'polymer' | 'non-polymer' | 'macrolide' | 'water' | 'branched'>(str),
|
||||
type: Aliased<'polymer' | 'non-polymer' | 'macrolide' | 'water' | 'branched'>(lstr),
|
||||
/**
|
||||
* A description of the entity.
|
||||
*
|
||||
@@ -820,12 +821,12 @@ export const mmCIF_Schema = {
|
||||
* one monomer-to-monomer link different from that implied by
|
||||
* _entity_poly.type.
|
||||
*/
|
||||
nstd_linkage: Aliased<'no' | 'n' | 'yes' | 'y'>(str),
|
||||
nstd_linkage: Aliased<'no' | 'n' | 'yes' | 'y'>(lstr),
|
||||
/**
|
||||
* A flag to indicate whether the polymer contains at least
|
||||
* one monomer that is not considered standard.
|
||||
*/
|
||||
nstd_monomer: Aliased<'no' | 'n' | 'yes' | 'y'>(str),
|
||||
nstd_monomer: Aliased<'no' | 'n' | 'yes' | 'y'>(lstr),
|
||||
/**
|
||||
* The type of the polymer.
|
||||
*/
|
||||
@@ -894,6 +895,10 @@ export const mmCIF_Schema = {
|
||||
* parent is not specified. Deoxynucleotides are
|
||||
* represented by their canonical one-letter codes of A,
|
||||
* C, G, or T.
|
||||
*
|
||||
* For modifications with several parent amino acids,
|
||||
* all corresponding parent amino acid codes will be listed
|
||||
* (ex. chromophores).
|
||||
*/
|
||||
pdbx_seq_one_letter_code_can: str,
|
||||
/**
|
||||
@@ -911,15 +916,14 @@ export const mmCIF_Schema = {
|
||||
*/
|
||||
entity_poly_seq: {
|
||||
/**
|
||||
* This data item is a pointer to _entity_poly.entity_id in the
|
||||
* ENTITY_POLY category.
|
||||
* This data item is a pointer to _entity.id in the ENTITY category.
|
||||
*/
|
||||
entity_id: str,
|
||||
/**
|
||||
* A flag to indicate whether this monomer in the polymer is
|
||||
* heterogeneous in sequence.
|
||||
*/
|
||||
hetero: Aliased<'no' | 'n' | 'yes' | 'y'>(str),
|
||||
hetero: Aliased<'no' | 'n' | 'yes' | 'y'>(lstr),
|
||||
/**
|
||||
* This data item is a pointer to _chem_comp.id in the CHEM_COMP
|
||||
* category.
|
||||
@@ -996,7 +1000,7 @@ export const mmCIF_Schema = {
|
||||
* The classification of the software according to the most
|
||||
* common types.
|
||||
*/
|
||||
type: Aliased<'program' | 'library' | 'package' | 'filter' | 'jiffy' | 'other'>(str),
|
||||
type: Aliased<'program' | 'library' | 'package' | 'filter' | 'jiffy' | 'other'>(lstr),
|
||||
/**
|
||||
* The version of the software.
|
||||
*/
|
||||
@@ -1119,7 +1123,7 @@ export const mmCIF_Schema = {
|
||||
* This data item is a pointer to _struct_conf_type.id in the
|
||||
* STRUCT_CONF_TYPE category.
|
||||
*/
|
||||
conf_type_id: Aliased<'BEND' | 'HELX_P' | 'HELX_OT_P' | 'HELX_RH_P' | 'HELX_RH_OT_P' | 'HELX_RH_AL_P' | 'HELX_RH_GA_P' | 'HELX_RH_OM_P' | 'HELX_RH_PI_P' | 'HELX_RH_27_P' | 'HELX_RH_3T_P' | 'HELX_RH_PP_P' | 'HELX_LH_P' | 'HELX_LH_OT_P' | 'HELX_LH_AL_P' | 'HELX_LH_GA_P' | 'HELX_LH_OM_P' | 'HELX_LH_PI_P' | 'HELX_LH_27_P' | 'HELX_LH_3T_P' | 'HELX_LH_PP_P' | 'HELX_N' | 'HELX_OT_N' | 'HELX_RH_N' | 'HELX_RH_OT_N' | 'HELX_RH_A_N' | 'HELX_RH_B_N' | 'HELX_RH_Z_N' | 'HELX_LH_N' | 'HELX_LH_OT_N' | 'HELX_LH_A_N' | 'HELX_LH_B_N' | 'HELX_LH_Z_N' | 'TURN_P' | 'TURN_OT_P' | 'TURN_TY1_P' | 'TURN_TY1P_P' | 'TURN_TY2_P' | 'TURN_TY2P_P' | 'TURN_TY3_P' | 'TURN_TY3P_P' | 'STRN' | 'OTHER'>(str),
|
||||
conf_type_id: Aliased<'bend' | 'helx_p' | 'helx_ot_p' | 'helx_rh_p' | 'helx_rh_ot_p' | 'helx_rh_al_p' | 'helx_rh_ga_p' | 'helx_rh_om_p' | 'helx_rh_pi_p' | 'helx_rh_27_p' | 'helx_rh_3t_p' | 'helx_rh_pp_p' | 'helx_lh_p' | 'helx_lh_ot_p' | 'helx_lh_al_p' | 'helx_lh_ga_p' | 'helx_lh_om_p' | 'helx_lh_pi_p' | 'helx_lh_27_p' | 'helx_lh_3t_p' | 'helx_lh_pp_p' | 'helx_n' | 'helx_ot_n' | 'helx_rh_n' | 'helx_rh_ot_n' | 'helx_rh_a_n' | 'helx_rh_b_n' | 'helx_rh_z_n' | 'helx_lh_n' | 'helx_lh_ot_n' | 'helx_lh_a_n' | 'helx_lh_b_n' | 'helx_lh_z_n' | 'turn_p' | 'turn_ot_p' | 'turn_ty1_p' | 'turn_ty1p_p' | 'turn_ty2_p' | 'turn_ty2p_p' | 'turn_ty3_p' | 'turn_ty3p_p' | 'strn' | 'other'>(lstr),
|
||||
/**
|
||||
* A description of special aspects of the conformation assignment.
|
||||
*/
|
||||
@@ -1219,7 +1223,7 @@ export const mmCIF_Schema = {
|
||||
* This data item is a pointer to _struct_conn_type.id in the
|
||||
* STRUCT_CONN_TYPE category.
|
||||
*/
|
||||
conn_type_id: Aliased<'covale' | 'disulf' | 'metalc' | 'hydrog'>(str),
|
||||
conn_type_id: Aliased<'covale' | 'disulf' | 'metalc' | 'hydrog'>(lstr),
|
||||
/**
|
||||
* A description of special aspects of the connection.
|
||||
*/
|
||||
@@ -1439,7 +1443,7 @@ export const mmCIF_Schema = {
|
||||
* The chemical bond order associated with the specified atoms in
|
||||
* this contact.
|
||||
*/
|
||||
pdbx_value_order: Aliased<'sing' | 'doub' | 'trip' | 'quad'>(str),
|
||||
pdbx_value_order: Aliased<'sing' | 'doub' | 'trip' | 'quad'>(lstr),
|
||||
},
|
||||
/**
|
||||
* Data items in the STRUCT_CONN_TYPE category record details
|
||||
@@ -1454,7 +1458,7 @@ export const mmCIF_Schema = {
|
||||
/**
|
||||
* The chemical or structural type of the interaction.
|
||||
*/
|
||||
id: Aliased<'covale' | 'disulf' | 'hydrog' | 'metalc' | 'mismat' | 'saltbr' | 'modres' | 'covale_base' | 'covale_sugar' | 'covale_phosphate'>(str),
|
||||
id: Aliased<'covale' | 'disulf' | 'hydrog' | 'metalc' | 'mismat' | 'saltbr' | 'modres' | 'covale_base' | 'covale_sugar' | 'covale_phosphate'>(lstr),
|
||||
/**
|
||||
* A reference that specifies the criteria used to define the
|
||||
* interaction.
|
||||
@@ -1808,7 +1812,7 @@ export const mmCIF_Schema = {
|
||||
/**
|
||||
* The cell settings for this space-group symmetry.
|
||||
*/
|
||||
cell_setting: Aliased<'triclinic' | 'monoclinic' | 'orthorhombic' | 'tetragonal' | 'rhombohedral' | 'trigonal' | 'hexagonal' | 'cubic'>(str),
|
||||
cell_setting: Aliased<'triclinic' | 'monoclinic' | 'orthorhombic' | 'tetragonal' | 'rhombohedral' | 'trigonal' | 'hexagonal' | 'cubic'>(lstr),
|
||||
/**
|
||||
* Space-group number from International Tables for Crystallography
|
||||
* Vol. A (2002).
|
||||
@@ -1868,7 +1872,7 @@ export const mmCIF_Schema = {
|
||||
* This code indicates whether the entry belongs to
|
||||
* Structural Genomics Project.
|
||||
*/
|
||||
SG_entry: Aliased<'Y' | 'N'>(str),
|
||||
SG_entry: Aliased<'y' | 'n'>(lstr),
|
||||
/**
|
||||
* The site where the file was deposited.
|
||||
*/
|
||||
@@ -1892,7 +1896,7 @@ export const mmCIF_Schema = {
|
||||
* A value of 'N' indicates that the no PDB format data file is
|
||||
* corresponding to this entry is available in the PDB archive.
|
||||
*/
|
||||
pdb_format_compatible: Aliased<'Y' | 'N'>(str),
|
||||
pdb_format_compatible: Aliased<'y' | 'n'>(lstr),
|
||||
},
|
||||
/**
|
||||
* The PDBX_NONPOLY_SCHEME category provides residue level nomenclature
|
||||
@@ -2045,7 +2049,7 @@ export const mmCIF_Schema = {
|
||||
* The value of polymer flag indicates whether the unobserved or
|
||||
* zero occupancy residue is part of a polymer chain or not
|
||||
*/
|
||||
polymer_flag: Aliased<'Y' | 'N'>(str),
|
||||
polymer_flag: Aliased<'y' | 'n'>(lstr),
|
||||
/**
|
||||
* The value of occupancy flag indicates whether the residue
|
||||
* is unobserved (= 1) or the coordinates have an occupancy of zero (=0)
|
||||
@@ -2298,7 +2302,7 @@ export const mmCIF_Schema = {
|
||||
/**
|
||||
* Defines the polymer characteristic of the entity.
|
||||
*/
|
||||
type: Aliased<'polymer' | 'polymer-like' | 'non-polymer' | 'branched'>(str),
|
||||
type: Aliased<'polymer' | 'polymer-like' | 'non-polymer' | 'branched'>(lstr),
|
||||
/**
|
||||
* Additional details about this entity.
|
||||
*/
|
||||
@@ -2393,7 +2397,7 @@ export const mmCIF_Schema = {
|
||||
/**
|
||||
* The bond order target for the chemical linkage.
|
||||
*/
|
||||
value_order: Aliased<'sing' | 'doub' | 'trip' | 'quad' | 'arom' | 'poly' | 'delo' | 'pi'>(str),
|
||||
value_order: Aliased<'sing' | 'doub' | 'trip' | 'quad' | 'arom' | 'poly' | 'delo' | 'pi'>(lstr),
|
||||
/**
|
||||
* The entity component identifier for the first of two entities containing the linkage.
|
||||
*/
|
||||
@@ -2479,7 +2483,7 @@ export const mmCIF_Schema = {
|
||||
/**
|
||||
* The bond order target for the non-standard linkage.
|
||||
*/
|
||||
value_order: Aliased<'sing' | 'doub' | 'trip' | 'quad' | 'arom' | 'poly' | 'delo' | 'pi'>(str),
|
||||
value_order: Aliased<'sing' | 'doub' | 'trip' | 'quad' | 'arom' | 'poly' | 'delo' | 'pi'>(lstr),
|
||||
},
|
||||
/**
|
||||
* Data items in the PDBX_MOLECULE category identify reference molecules
|
||||
@@ -2514,11 +2518,11 @@ export const mmCIF_Schema = {
|
||||
/**
|
||||
* Broadly defines the function of the molecule.
|
||||
*/
|
||||
class: Aliased<'Antagonist' | 'Antibiotic' | 'Anticancer' | 'Anticoagulant' | 'Antifungal' | 'Antigen' | 'Antiinflammatory' | 'Antimicrobial' | 'Antineoplastic' | 'Antiparasitic' | 'Antiretroviral' | 'Anthelmintic' | 'Antithrombotic' | 'Antitumor' | 'Antiviral' | 'CASPASE inhibitor' | 'Chaperone binding' | 'Enzyme inhibitor' | 'Drug delivery' | 'Glycan component' | 'Growth factor' | 'Immunosuppressant' | 'Inducer' | 'Inhibitor' | 'Lantibiotic' | 'Metabolism' | 'Metal transport' | 'Nutrient' | 'Oxidation-reduction' | 'Protein binding' | 'Receptor' | 'Substrate analog' | 'Synthetic opioid' | 'Thrombin inhibitor' | 'Transition state mimetic' | 'Transport activator' | 'Trypsin inhibitor' | 'Toxin' | 'Unknown' | 'Water retention' | 'Anticoagulant, Antithrombotic' | 'Antibiotic, Antimicrobial' | 'Antibiotic, Anthelmintic' | 'Antibiotic, Antineoplastic' | 'Antimicrobial, Antiretroviral' | 'Antimicrobial, Antitumor' | 'Antimicrobial, Antiparasitic, Antibiotic' | 'Thrombin inhibitor, Trypsin inhibitor'>(str),
|
||||
class: Aliased<'antagonist' | 'antibiotic' | 'anticancer' | 'anticoagulant' | 'antifungal' | 'antigen' | 'antiinflammatory' | 'antimicrobial' | 'antineoplastic' | 'antiparasitic' | 'antiretroviral' | 'anthelmintic' | 'antithrombotic' | 'antitumor' | 'antiviral' | 'caspase inhibitor' | 'chaperone binding' | 'enzyme inhibitor' | 'drug delivery' | 'glycan component' | 'growth factor' | 'immunosuppressant' | 'inducer' | 'inhibitor' | 'lantibiotic' | 'metabolism' | 'metal transport' | 'nutrient' | 'oxidation-reduction' | 'protein binding' | 'receptor' | 'substrate analog' | 'synthetic opioid' | 'thrombin inhibitor' | 'transition state mimetic' | 'transport activator' | 'trypsin inhibitor' | 'toxin' | 'unknown' | 'water retention' | 'anticoagulant, antithrombotic' | 'antibiotic, antimicrobial' | 'antibiotic, anthelmintic' | 'antibiotic, antineoplastic' | 'antimicrobial, antiretroviral' | 'antimicrobial, antitumor' | 'antimicrobial, antiparasitic, antibiotic' | 'thrombin inhibitor, trypsin inhibitor'>(lstr),
|
||||
/**
|
||||
* Defines the structural classification of the molecule.
|
||||
*/
|
||||
type: Aliased<'Amino acid' | 'Aminoglycoside' | 'Anthracycline' | 'Anthraquinone' | 'Ansamycin' | 'Chalkophore' | 'Chromophore' | 'Glycopeptide' | 'Cyclic depsipeptide' | 'Cyclic lipopeptide' | 'Cyclic peptide' | 'Heterocyclic' | 'Imino sugar' | 'Keto acid' | 'Lipoglycopeptide' | 'Lipopeptide' | 'Macrolide' | 'Non-polymer' | 'Nucleoside' | 'Oligopeptide' | 'Oligosaccharide' | 'Peptaibol' | 'Peptide-like' | 'Polycyclic' | 'Polypeptide' | 'Polysaccharide' | 'Quinolone' | 'Thiolactone' | 'Thiopeptide' | 'Siderophore' | 'Unknown' | 'Chalkophore, Polypeptide'>(str),
|
||||
type: Aliased<'amino acid' | 'aminoglycoside' | 'anthracycline' | 'anthraquinone' | 'ansamycin' | 'chalkophore' | 'chromophore' | 'glycopeptide' | 'cyclic depsipeptide' | 'cyclic lipopeptide' | 'cyclic peptide' | 'heterocyclic' | 'imino sugar' | 'keto acid' | 'lipoglycopeptide' | 'lipopeptide' | 'macrolide' | 'non-polymer' | 'nucleoside' | 'oligopeptide' | 'oligosaccharide' | 'peptaibol' | 'peptide-like' | 'polycyclic' | 'polypeptide' | 'polysaccharide' | 'quinolone' | 'thiolactone' | 'thiopeptide' | 'siderophore' | 'unknown' | 'chalkophore, polypeptide'>(lstr),
|
||||
/**
|
||||
* A name of the molecule.
|
||||
*/
|
||||
@@ -2665,7 +2669,7 @@ export const mmCIF_Schema = {
|
||||
/**
|
||||
* This data item contains the descriptor type.
|
||||
*/
|
||||
type: Aliased<'LINUCS' | 'Glycam Condensed Sequence' | 'Glycam Condensed Core Sequence' | 'WURCS'>(str),
|
||||
type: Aliased<'linucs' | 'glycam condensed sequence' | 'glycam condensed core sequence' | 'wurcs'>(lstr),
|
||||
/**
|
||||
* This data item contains the name of the program
|
||||
* or library used to compute the descriptor.
|
||||
@@ -2740,7 +2744,7 @@ export const mmCIF_Schema = {
|
||||
* A flag to indicate whether this monomer in the entity is
|
||||
* heterogeneous in sequence.
|
||||
*/
|
||||
hetero: Aliased<'no' | 'n' | 'yes' | 'y'>(str),
|
||||
hetero: Aliased<'no' | 'n' | 'yes' | 'y'>(lstr),
|
||||
/**
|
||||
* This data item is a pointer to _chem_comp.id in the CHEM_COMP
|
||||
* category.
|
||||
@@ -2812,7 +2816,7 @@ export const mmCIF_Schema = {
|
||||
/**
|
||||
* The chiral configuration of the first atom making the linkage.
|
||||
*/
|
||||
atom_stereo_config_1: Aliased<'R' | 'S' | 'N'>(str),
|
||||
atom_stereo_config_1: Aliased<'r' | 's' | 'n'>(lstr),
|
||||
/**
|
||||
* The atom identifier/name for the second atom making the linkage.
|
||||
*/
|
||||
@@ -2824,11 +2828,11 @@ export const mmCIF_Schema = {
|
||||
/**
|
||||
* The chiral configuration of the second atom making the linkage.
|
||||
*/
|
||||
atom_stereo_config_2: Aliased<'R' | 'S' | 'N'>(str),
|
||||
atom_stereo_config_2: Aliased<'r' | 's' | 'n'>(lstr),
|
||||
/**
|
||||
* The bond order target for the chemical linkage.
|
||||
*/
|
||||
value_order: Aliased<'sing' | 'doub' | 'trip' | 'quad' | 'arom' | 'poly' | 'delo' | 'pi'>(str),
|
||||
value_order: Aliased<'sing' | 'doub' | 'trip' | 'quad' | 'arom' | 'poly' | 'delo' | 'pi'>(lstr),
|
||||
},
|
||||
/**
|
||||
* Data items in the PDBX_ENTITY_BRANCH category specify the list
|
||||
@@ -2859,7 +2863,7 @@ export const mmCIF_Schema = {
|
||||
* A flag to indicate whether this monomer in the entity is
|
||||
* heterogeneous in sequence.
|
||||
*/
|
||||
hetero: Aliased<'no' | 'n' | 'yes' | 'y'>(str),
|
||||
hetero: Aliased<'no' | 'n' | 'yes' | 'y'>(lstr),
|
||||
/**
|
||||
* Pointer to _atom_site.label_asym_id.
|
||||
*/
|
||||
@@ -3332,15 +3336,15 @@ export const mmCIF_Schema = {
|
||||
/**
|
||||
* A flag to indicate if the modeling is multi scale.
|
||||
*/
|
||||
multi_scale_flag: Aliased<'YES' | 'NO'>(str),
|
||||
multi_scale_flag: Aliased<'yes' | 'no'>(lstr),
|
||||
/**
|
||||
* A flag to indicate if the modeling is multi state.
|
||||
*/
|
||||
multi_state_flag: Aliased<'YES' | 'NO'>(str),
|
||||
multi_state_flag: Aliased<'yes' | 'no'>(lstr),
|
||||
/**
|
||||
* A flag to indicate if the modeling involves an ensemble ordered by time or other order.
|
||||
*/
|
||||
ordered_flag: Aliased<'YES' | 'NO'>(str),
|
||||
ordered_flag: Aliased<'yes' | 'no'>(lstr),
|
||||
/**
|
||||
* The file id corresponding to the script used in the modeling protocol step.
|
||||
* This data item is a pointer to _ihm_external_files.id in the IHM_EXTERNAL_FILES category.
|
||||
@@ -3629,7 +3633,7 @@ export const mmCIF_Schema = {
|
||||
* A flag that indicates whether the dataset is archived in
|
||||
* an IHM related database or elsewhere.
|
||||
*/
|
||||
database_hosted: Aliased<'YES' | 'NO'>(str),
|
||||
database_hosted: Aliased<'yes' | 'no'>(lstr),
|
||||
},
|
||||
/**
|
||||
* Category to define groups or collections of input datasets.
|
||||
@@ -4236,7 +4240,7 @@ export const mmCIF_Schema = {
|
||||
* whether the whole image is used or only a portion of it is used (by masking
|
||||
* or by other means) as restraint in the modeling.
|
||||
*/
|
||||
image_segment_flag: Aliased<'YES' | 'NO'>(str),
|
||||
image_segment_flag: Aliased<'yes' | 'no'>(lstr),
|
||||
/**
|
||||
* Number of 2D projections of the model used in the fitting.
|
||||
*/
|
||||
@@ -4389,7 +4393,7 @@ export const mmCIF_Schema = {
|
||||
* whether the whole SAS profile is used or only a portion of it is used
|
||||
* (by masking or by other means) as restraint in the modeling.
|
||||
*/
|
||||
profile_segment_flag: Aliased<'YES' | 'NO'>(str),
|
||||
profile_segment_flag: Aliased<'yes' | 'no'>(lstr),
|
||||
/**
|
||||
* The type of atoms in the model fit to the SAS data.
|
||||
*/
|
||||
@@ -4934,7 +4938,7 @@ export const mmCIF_Schema = {
|
||||
/**
|
||||
* The type of data held in the dataset.
|
||||
*/
|
||||
content_type: Aliased<'target' | 'template structure' | 'polymeric template library' | 'spatial restraints' | 'target-template alignment' | 'coevolution MSA' | 'model coordinates' | 'other'>(str),
|
||||
content_type: Aliased<'target' | 'template structure' | 'polymeric template library' | 'spatial restraints' | 'target-template alignment' | 'coevolution MSA' | 'model coordinates' | 'input structure' | 'reference database' | 'other'>(str),
|
||||
/**
|
||||
* Details for other content types.
|
||||
*/
|
||||
@@ -4983,7 +4987,7 @@ export const mmCIF_Schema = {
|
||||
/**
|
||||
* The type of QA metric.
|
||||
*/
|
||||
type: Aliased<'zscore' | 'energy' | 'distance' | 'normalized score' | 'pLDDT' | 'PAE' | 'contact probability' | 'other'>(str),
|
||||
type: Aliased<'zscore' | 'energy' | 'distance' | 'normalized score' | 'pLDDT' | 'pLDDT in [0,1]' | 'pLDDT all-atom' | 'pLDDT all-atom in [0,1]' | 'PAE' | 'pTM' | 'ipTM' | 'contact probability' | 'other'>(str),
|
||||
/**
|
||||
* The mode of calculation of the QA metric.
|
||||
*/
|
||||
|
||||
@@ -122,7 +122,7 @@ async function parseBinary(taskCtx: RuntimeContext, data: Uint8Array, name: stri
|
||||
}
|
||||
|
||||
export function parseDx(data: string | Uint8Array, name: string) {
|
||||
return Task.create<Result<DxFile>>('Parse Cube', taskCtx => {
|
||||
return Task.create<Result<DxFile>>('Parse DX', taskCtx => {
|
||||
if (typeof data === 'string') return parseText(taskCtx, data, name);
|
||||
return parseBinary(taskCtx, data, name);
|
||||
});
|
||||
|
||||
@@ -9,12 +9,14 @@ import { Writer } from './writer';
|
||||
import { Encoder, Category, Field } from './cif/encoder';
|
||||
import { ComponentAtom } from '../../mol-model-formats/structure/property/atoms/chem_comp';
|
||||
import { ComponentBond } from '../../mol-model-formats/structure/property/bonds/chem_comp';
|
||||
import { getElementIdx, isHydrogen } from '../../mol-model/structure/structure/unit/bonds/common';
|
||||
import { ElementSymbol } from '../../mol-model/structure/model/types';
|
||||
|
||||
interface Atom {
|
||||
Cartn_x: number,
|
||||
Cartn_y: number,
|
||||
Cartn_z: number,
|
||||
type_symbol: string,
|
||||
type_symbol: ElementSymbol,
|
||||
index: number
|
||||
}
|
||||
|
||||
@@ -109,11 +111,12 @@ export abstract class LigandEncoder implements Encoder<string> {
|
||||
const key = it.move();
|
||||
|
||||
const lai = label_atom_id.value(key, data, index) as string;
|
||||
const ts = type_symbol.value(key, data, index) as string;
|
||||
if (this.skipHydrogen(ts)) {
|
||||
index++;
|
||||
continue;
|
||||
}
|
||||
// ignore all alternate locations after the first
|
||||
if (atoms.has(lai)) continue;
|
||||
|
||||
const ts = type_symbol.value(key, data, index) as ElementSymbol;
|
||||
if (this.skipHydrogen(ts)) continue;
|
||||
|
||||
const a: { [k: string]: (string | number) } = {};
|
||||
|
||||
for (let _f = 0, _fl = fields.length; _f < _fl; _f++) {
|
||||
@@ -131,11 +134,15 @@ export abstract class LigandEncoder implements Encoder<string> {
|
||||
return atoms;
|
||||
}
|
||||
|
||||
protected skipHydrogen(type_symbol: string) {
|
||||
protected skipHydrogen(type_symbol: ElementSymbol) {
|
||||
if (this.hydrogens) {
|
||||
return false;
|
||||
}
|
||||
return type_symbol === 'H';
|
||||
return this.isHydrogen(type_symbol);
|
||||
}
|
||||
|
||||
protected isHydrogen(type_symbol: ElementSymbol) {
|
||||
return isHydrogen(getElementIdx(type_symbol));
|
||||
}
|
||||
|
||||
private getSortedFields<Ctx>(instance: Category.Instance<Ctx>, names: string[]) {
|
||||
|
||||
@@ -26,14 +26,27 @@ export class MolEncoder extends LigandEncoder {
|
||||
|
||||
const atomMap = this.componentAtomData.entries.get(name)!;
|
||||
const bondMap = this.componentBondData.entries.get(name)!;
|
||||
// happens for the unknown ligands (UNL)
|
||||
if (!atomMap) throw Error(`The Chemical Component Dictionary doesn't hold any atom data for ${name}`);
|
||||
|
||||
let bondCount = 0;
|
||||
let chiral = false;
|
||||
|
||||
// traverse once to determine all actually present atoms
|
||||
const atoms = this.getAtoms(instance, source);
|
||||
atoms.forEach((atom1, label_atom_id1) => {
|
||||
const { index: i1 } = atom1;
|
||||
const { charge, stereo_config } = atomMap.map.get(label_atom_id1)!;
|
||||
const { index: i1, type_symbol: type_symbol1 } = atom1;
|
||||
const atomMapData1 = atomMap.map.get(label_atom_id1);
|
||||
|
||||
if (!atomMapData1) {
|
||||
if (this.isHydrogen(type_symbol1)) {
|
||||
return;
|
||||
} else {
|
||||
throw Error(`Unknown atom ${label_atom_id1} for component ${name}`);
|
||||
}
|
||||
}
|
||||
|
||||
const { charge, stereo_config } = atomMapData1;
|
||||
StringBuilder.writePadLeft(ctab, atom1.Cartn_x.toFixed(4), 10);
|
||||
StringBuilder.writePadLeft(ctab, atom1.Cartn_y.toFixed(4), 10);
|
||||
StringBuilder.writePadLeft(ctab, atom1.Cartn_z.toFixed(4), 10);
|
||||
@@ -42,7 +55,7 @@ export class MolEncoder extends LigandEncoder {
|
||||
StringBuilder.writeSafe(ctab, ' 0');
|
||||
StringBuilder.writeIntegerPadLeft(ctab, this.mapCharge(charge), 3);
|
||||
StringBuilder.writeSafe(ctab, ' 0 0 0 0 0 0 0 0 0 0\n');
|
||||
if (stereo_config !== 'N') chiral = true;
|
||||
if (stereo_config !== 'n') chiral = true;
|
||||
|
||||
// no data for metal ions
|
||||
if (!bondMap?.map) return;
|
||||
@@ -50,8 +63,8 @@ export class MolEncoder extends LigandEncoder {
|
||||
const atom2 = atoms.get(label_atom_id2);
|
||||
if (!atom2) return;
|
||||
|
||||
const { index: i2, type_symbol: type_symbol2 } = atom2;
|
||||
if (i1 < i2 && !this.skipHydrogen(type_symbol2)) {
|
||||
const { index: i2 } = atom2;
|
||||
if (i1 < i2) {
|
||||
const { order } = bond;
|
||||
StringBuilder.writeIntegerPadLeft(bonds, i1 + 1, 3);
|
||||
StringBuilder.writeIntegerPadLeft(bonds, i2 + 1, 3);
|
||||
|
||||
@@ -29,21 +29,34 @@ export class Mol2Encoder extends LigandEncoder {
|
||||
const name = this.getName(instance, source);
|
||||
StringBuilder.writeSafe(this.builder, `# Name: ${name}\n# Created by ${this.encoder}\n\n`);
|
||||
|
||||
const atomMap = this.componentAtomData.entries.get(name)!;
|
||||
const bondMap = this.componentBondData.entries.get(name)!;
|
||||
// happens for the unknown ligands (UNL)
|
||||
if (!atomMap) throw Error(`The Chemical Component Dictionary doesn't hold any atom data for ${name}`);
|
||||
let bondCount = 0;
|
||||
|
||||
const atoms = this.getAtoms(instance, source);
|
||||
StringBuilder.writeSafe(a, '@<TRIPOS>ATOM\n');
|
||||
StringBuilder.writeSafe(b, '@<TRIPOS>BOND\n');
|
||||
atoms.forEach((atom1, label_atom_id1) => {
|
||||
const { index: i1 } = atom1;
|
||||
const { index: i1, type_symbol: type_symbol1 } = atom1;
|
||||
const atomMapData1 = atomMap.map.get(label_atom_id1);
|
||||
|
||||
if (!atomMapData1) {
|
||||
if (this.isHydrogen(type_symbol1)) {
|
||||
return;
|
||||
} else {
|
||||
throw Error(`Unknown atom ${label_atom_id1} for component ${name}`);
|
||||
}
|
||||
}
|
||||
|
||||
if (bondMap?.map) {
|
||||
bondMap.map.get(label_atom_id1)!.forEach((bond, label_atom_id2) => {
|
||||
const atom2 = atoms.get(label_atom_id2);
|
||||
if (!atom2) return;
|
||||
|
||||
const { index: i2, type_symbol: type_symbol2 } = atom2;
|
||||
if (i1 < i2 && !this.skipHydrogen(type_symbol2)) {
|
||||
const { index: i2 } = atom2;
|
||||
if (i1 < i2) {
|
||||
const { order, flags } = bond;
|
||||
const ar = BondType.is(BondType.Flag.Aromatic, flags);
|
||||
StringBuilder.writeSafe(b, `${++bondCount} ${i1 + 1} ${i2 + 1} ${ar ? 'ar' : order}`);
|
||||
@@ -52,7 +65,7 @@ export class Mol2Encoder extends LigandEncoder {
|
||||
});
|
||||
}
|
||||
|
||||
const sybyl = bondMap?.map ? this.mapToSybyl(label_atom_id1, atom1.type_symbol, bondMap) : atom1.type_symbol;
|
||||
const sybyl = bondMap?.map ? this.mapToSybyl(label_atom_id1, type_symbol1, bondMap) : type_symbol1;
|
||||
StringBuilder.writeSafe(a, `${i1 + 1} ${label_atom_id1} ${atom1.Cartn_x.toFixed(3)} ${atom1.Cartn_y.toFixed(3)} ${atom1.Cartn_z.toFixed(3)} ${sybyl} 1 ${name} 0.000\n`);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2018-2019 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* @author David Sehnal <david.sehnal@gmail.com>
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
@@ -26,7 +26,8 @@ export type DensityData = {
|
||||
transform: Mat4,
|
||||
field: Tensor,
|
||||
idField: Tensor,
|
||||
resolution: number
|
||||
resolution: number,
|
||||
maxRadius: number,
|
||||
}
|
||||
|
||||
export type DensityTextureData = {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2018-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
*/
|
||||
@@ -21,12 +21,12 @@ export type GaussianDensityProps = typeof DefaultGaussianDensityProps
|
||||
|
||||
export type GaussianDensityData = {
|
||||
radiusFactor: number
|
||||
resolution: number
|
||||
} & DensityData
|
||||
|
||||
export type GaussianDensityTextureData = {
|
||||
radiusFactor: number
|
||||
resolution: number
|
||||
maxRadius: number
|
||||
} & DensityTextureData
|
||||
|
||||
export function computeGaussianDensity(position: PositionData, box: Box3D, radius: (index: number) => number, props: GaussianDensityProps) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2018-2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
*/
|
||||
@@ -129,5 +129,5 @@ export async function GaussianDensityCPU(ctx: RuntimeContext, position: Position
|
||||
Mat4.fromScaling(transform, Vec3.create(resolution, resolution, resolution));
|
||||
Mat4.setTranslation(transform, expandedBox.min);
|
||||
|
||||
return { field, idField, transform, radiusFactor: 1, resolution };
|
||||
return { field, idField, transform, radiusFactor: 1, resolution, maxRadius };
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2017-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2017-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
* @author Michael Krone <michael.krone@uni-tuebingen.de>
|
||||
@@ -70,12 +70,12 @@ export function GaussianDensityGPU(position: PositionData, box: Box3D, radius: (
|
||||
// it's faster than texture3d
|
||||
// console.time('GaussianDensityTexture2d')
|
||||
const tmpTexture = getTexture('tmp', webgl, 'image-uint8', 'rgba', 'ubyte', 'linear');
|
||||
const { scale, bbox, texture, gridDim, gridTexDim, radiusFactor, resolution } = calcGaussianDensityTexture2d(webgl, position, box, radius, false, props, tmpTexture);
|
||||
const { scale, bbox, texture, gridDim, gridTexDim, radiusFactor, resolution, maxRadius } = calcGaussianDensityTexture2d(webgl, position, box, radius, false, props, tmpTexture);
|
||||
// webgl.waitForGpuCommandsCompleteSync()
|
||||
// console.timeEnd('GaussianDensityTexture2d')
|
||||
const { field, idField } = fieldFromTexture2d(webgl, texture, gridDim, gridTexDim);
|
||||
|
||||
return { field, idField, transform: getTransform(scale, bbox), radiusFactor, resolution };
|
||||
return { field, idField, transform: getTransform(scale, bbox), radiusFactor, resolution, maxRadius };
|
||||
}
|
||||
|
||||
export function GaussianDensityTexture(webgl: WebGLContext, position: PositionData, box: Box3D, radius: (index: number) => number, props: GaussianDensityProps, oldTexture?: Texture): GaussianDensityTextureData {
|
||||
@@ -92,8 +92,8 @@ export function GaussianDensityTexture3d(webgl: WebGLContext, position: Position
|
||||
return finalizeGaussianDensityTexture(calcGaussianDensityTexture3d(webgl, position, box, radius, props, oldTexture));
|
||||
}
|
||||
|
||||
function finalizeGaussianDensityTexture({ texture, scale, bbox, gridDim, gridTexDim, gridTexScale, radiusFactor, resolution }: _GaussianDensityTextureData): GaussianDensityTextureData {
|
||||
return { transform: getTransform(scale, bbox), texture, bbox, gridDim, gridTexDim, gridTexScale, radiusFactor, resolution };
|
||||
function finalizeGaussianDensityTexture({ texture, scale, bbox, gridDim, gridTexDim, gridTexScale, radiusFactor, resolution, maxRadius }: _GaussianDensityTextureData): GaussianDensityTextureData {
|
||||
return { transform: getTransform(scale, bbox), texture, bbox, gridDim, gridTexDim, gridTexScale, radiusFactor, resolution, maxRadius };
|
||||
}
|
||||
|
||||
function getTransform(scale: Vec3, bbox: Box3D) {
|
||||
@@ -114,6 +114,7 @@ type _GaussianDensityTextureData = {
|
||||
gridTexScale: Vec2
|
||||
radiusFactor: number
|
||||
resolution: number
|
||||
maxRadius: number
|
||||
}
|
||||
|
||||
function calcGaussianDensityTexture2d(webgl: WebGLContext, position: PositionData, box: Box3D, radius: (index: number) => number, powerOfTwo: boolean, props: GaussianDensityProps, texture?: Texture): _GaussianDensityTextureData {
|
||||
@@ -198,7 +199,7 @@ function calcGaussianDensityTexture2d(webgl: WebGLContext, position: PositionDat
|
||||
|
||||
// printTexture(webgl, minDistTex, 0.75);
|
||||
|
||||
return { texture, scale, bbox: expandedBox, gridDim: dim, gridTexDim, gridTexScale, radiusFactor, resolution };
|
||||
return { texture, scale, bbox: expandedBox, gridDim: dim, gridTexDim, gridTexScale, radiusFactor, resolution, maxRadius };
|
||||
}
|
||||
|
||||
function calcGaussianDensityTexture3d(webgl: WebGLContext, position: PositionData, box: Box3D, radius: (index: number) => number, props: GaussianDensityProps, texture?: Texture): _GaussianDensityTextureData {
|
||||
@@ -254,7 +255,7 @@ function calcGaussianDensityTexture3d(webgl: WebGLContext, position: PositionDat
|
||||
setupGroupIdRendering(webgl, renderable);
|
||||
render(texture, false);
|
||||
|
||||
return { texture, scale, bbox: expandedBox, gridDim: dim, gridTexDim: dim, gridTexScale, radiusFactor, resolution };
|
||||
return { texture, scale, bbox: expandedBox, gridDim: dim, gridTexDim: dim, gridTexScale, radiusFactor, resolution, maxRadius };
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2018-2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* @author David Sehnal <david.sehnal@gmail.com>
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
@@ -172,7 +172,7 @@ function build(data: PositionData, boundary: Boundary, cellSizeOrCount?: Vec3 |
|
||||
const expandedBox = Box3D.expand(Box3D(), boundary.box, Vec3.create(0.5, 0.5, 0.5));
|
||||
const { indices } = data;
|
||||
|
||||
const S = Box3D.size(Vec3.zero(), expandedBox);
|
||||
const S = Box3D.size(Vec3(), expandedBox);
|
||||
let delta, size;
|
||||
|
||||
const elementCount = OrderedSet.size(indices);
|
||||
@@ -180,7 +180,7 @@ function build(data: PositionData, boundary: Boundary, cellSizeOrCount?: Vec3 |
|
||||
const cellCount = typeof cellSizeOrCount === 'number' ? cellSizeOrCount : 32;
|
||||
const cellSize = Array.isArray(cellSizeOrCount) && cellSizeOrCount;
|
||||
|
||||
if (cellSize) {
|
||||
if (cellSize && !Vec3.isZero(cellSize)) {
|
||||
size = [Math.ceil(S[0] / cellSize[0]), Math.ceil(S[1] / cellSize[1]), Math.ceil(S[2] / cellSize[2])];
|
||||
delta = cellSize;
|
||||
} else if (elementCount > 0) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2019-2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2019-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* @author Fred Ludlow <fred.ludlow@gmail.com>
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
@@ -370,5 +370,5 @@ export async function calcMolecularSurface(ctx: RuntimeContext, position: Requir
|
||||
Mat4.fromScaling(transform, Vec3.create(resolution, resolution, resolution));
|
||||
Mat4.setTranslation(transform, expandedBox.min);
|
||||
// console.log({ field, idField, transform, updateChunk })
|
||||
return { field, idField, transform, resolution };
|
||||
return { field, idField, transform, resolution, maxRadius };
|
||||
}
|
||||
@@ -32,7 +32,9 @@ namespace Box3D {
|
||||
|
||||
/** Get box from sphere, uses extrema if available */
|
||||
export function fromSphere3D(out: Box3D, sphere: Sphere3D): Box3D {
|
||||
if (Sphere3D.hasExtrema(sphere)) return fromVec3Array(out, sphere.extrema);
|
||||
if (Sphere3D.hasExtrema(sphere) && sphere.extrema.length >= 14) { // 14 extrema with coarse boundary helper
|
||||
return fromVec3Array(out, sphere.extrema);
|
||||
}
|
||||
const r = Vec3.create(sphere.radius, sphere.radius, sphere.radius);
|
||||
Vec3.sub(out.min, sphere.center, r);
|
||||
Vec3.add(out.max, sphere.center, r);
|
||||
|
||||
@@ -212,19 +212,26 @@ namespace Sphere3D {
|
||||
Axes3D.scale(axes, Axes3D.normalize(axes, axes), delta);
|
||||
|
||||
setExtrema(out, sphere.extrema.map(e => {
|
||||
Vec3.sub(tmpDir, e, sphere.center);
|
||||
const out = Vec3.clone(e);
|
||||
Vec3.normalize(tmpDir, Vec3.sub(tmpDir, e, sphere.center));
|
||||
const o = Vec3.clone(e);
|
||||
|
||||
const sA = Vec3.dot(tmpDir, axes.dirA) < 0 ? -1 : 1;
|
||||
Vec3.scaleAndAdd(out, out, axes.dirA, sA);
|
||||
Vec3.scaleAndAdd(o, o, axes.dirA, sA);
|
||||
|
||||
const sB = Vec3.dot(tmpDir, axes.dirB) < 0 ? -1 : 1;
|
||||
Vec3.scaleAndAdd(out, out, axes.dirB, sB);
|
||||
Vec3.scaleAndAdd(o, o, axes.dirB, sB);
|
||||
|
||||
const sC = Vec3.dot(tmpDir, axes.dirC) < 0 ? -1 : 1;
|
||||
Vec3.scaleAndAdd(out, out, axes.dirC, sC);
|
||||
Vec3.scaleAndAdd(o, o, axes.dirC, sC);
|
||||
|
||||
return out;
|
||||
if (Vec3.distance(out.center, o) > out.radius) {
|
||||
if (sphere.extrema.length >= 14) { // 14 extrema with coarse boundary helper
|
||||
Vec3.normalize(tmpDir, Vec3.sub(tmpDir, o, sphere.center));
|
||||
}
|
||||
Vec3.scaleAndAdd(o, out.center, tmpDir, out.radius);
|
||||
}
|
||||
|
||||
return o;
|
||||
}));
|
||||
}
|
||||
return out;
|
||||
|
||||
@@ -10,6 +10,9 @@ import { Entities, EntitySubtype } from '../../../mol-model/structure/model/prop
|
||||
import { getEntityType, getEntitySubtype } from '../../../mol-model/structure/model/types';
|
||||
import { ElementIndex, EntityIndex, Model } from '../../../mol-model/structure/model';
|
||||
import { BasicData, BasicSchema, Entity } from './schema';
|
||||
import { mmCIF_chemComp_schema } from '../../../mol-io/reader/cif/schema/mmcif-extras';
|
||||
|
||||
type ChemCompType = mmCIF_chemComp_schema['type']['T'];
|
||||
|
||||
export function getEntityData(data: BasicData): Entities {
|
||||
let entityData: Entity;
|
||||
@@ -96,7 +99,7 @@ export function getEntityData(data: BasicData): Entities {
|
||||
}
|
||||
|
||||
if (assignSubtype) {
|
||||
const chemCompType = new Map<string, string>();
|
||||
const chemCompType = new Map<string, ChemCompType>();
|
||||
if (data.chem_comp) {
|
||||
const { id, type } = data.chem_comp;
|
||||
for (let i = 0, il = data.chem_comp._rowCount; i < il; i++) {
|
||||
@@ -110,7 +113,7 @@ export function getEntityData(data: BasicData): Entities {
|
||||
const entityId = label_entity_id.value(i);
|
||||
if (!entityIds.has(entityId)) {
|
||||
const compId = label_comp_id.value(i);
|
||||
const compType = chemCompType.get(compId) || '';
|
||||
const compType = chemCompType.get(compId) || 'other';
|
||||
subtypes[getEntityIndex(entityId)] = getEntitySubtype(compId, compType);
|
||||
entityIds.add(entityId);
|
||||
}
|
||||
|
||||
@@ -37,48 +37,48 @@ const NonPolymerNames = new Set([
|
||||
const StandardComponents = (function () {
|
||||
const map = new Map<string, Component>();
|
||||
const components: Component[] = [
|
||||
{ id: 'HIS', name: 'HISTIDINE', type: 'L-peptide linking' },
|
||||
{ id: 'ARG', name: 'ARGININE', type: 'L-peptide linking' },
|
||||
{ id: 'LYS', name: 'LYSINE', type: 'L-peptide linking' },
|
||||
{ id: 'ILE', name: 'ISOLEUCINE', type: 'L-peptide linking' },
|
||||
{ id: 'PHE', name: 'PHENYLALANINE', type: 'L-peptide linking' },
|
||||
{ id: 'LEU', name: 'LEUCINE', type: 'L-peptide linking' },
|
||||
{ id: 'TRP', name: 'TRYPTOPHAN', type: 'L-peptide linking' },
|
||||
{ id: 'ALA', name: 'ALANINE', type: 'L-peptide linking' },
|
||||
{ id: 'MET', name: 'METHIONINE', type: 'L-peptide linking' },
|
||||
{ id: 'CYS', name: 'CYSTEINE', type: 'L-peptide linking' },
|
||||
{ id: 'ASN', name: 'ASPARAGINE', type: 'L-peptide linking' },
|
||||
{ id: 'VAL', name: 'VALINE', type: 'L-peptide linking' },
|
||||
{ id: 'HIS', name: 'HISTIDINE', type: 'l-peptide linking' },
|
||||
{ id: 'ARG', name: 'ARGININE', type: 'l-peptide linking' },
|
||||
{ id: 'LYS', name: 'LYSINE', type: 'l-peptide linking' },
|
||||
{ id: 'ILE', name: 'ISOLEUCINE', type: 'l-peptide linking' },
|
||||
{ id: 'PHE', name: 'PHENYLALANINE', type: 'l-peptide linking' },
|
||||
{ id: 'LEU', name: 'LEUCINE', type: 'l-peptide linking' },
|
||||
{ id: 'TRP', name: 'TRYPTOPHAN', type: 'l-peptide linking' },
|
||||
{ id: 'ALA', name: 'ALANINE', type: 'l-peptide linking' },
|
||||
{ id: 'MET', name: 'METHIONINE', type: 'l-peptide linking' },
|
||||
{ id: 'CYS', name: 'CYSTEINE', type: 'l-peptide linking' },
|
||||
{ id: 'ASN', name: 'ASPARAGINE', type: 'l-peptide linking' },
|
||||
{ id: 'VAL', name: 'VALINE', type: 'l-peptide linking' },
|
||||
{ id: 'GLY', name: 'GLYCINE', type: 'peptide linking' },
|
||||
{ id: 'SER', name: 'SERINE', type: 'L-peptide linking' },
|
||||
{ id: 'GLN', name: 'GLUTAMINE', type: 'L-peptide linking' },
|
||||
{ id: 'TYR', name: 'TYROSINE', type: 'L-peptide linking' },
|
||||
{ id: 'ASP', name: 'ASPARTIC ACID', type: 'L-peptide linking' },
|
||||
{ id: 'GLU', name: 'GLUTAMIC ACID', type: 'L-peptide linking' },
|
||||
{ id: 'THR', name: 'THREONINE', type: 'L-peptide linking' },
|
||||
{ id: 'PRO', name: 'PROLINE', type: 'L-peptide linking' },
|
||||
{ id: 'SEC', name: 'SELENOCYSTEINE', type: 'L-peptide linking' },
|
||||
{ id: 'PYL', name: 'PYRROLYSINE', type: 'L-peptide linking' },
|
||||
{ id: 'SER', name: 'SERINE', type: 'l-peptide linking' },
|
||||
{ id: 'GLN', name: 'GLUTAMINE', type: 'l-peptide linking' },
|
||||
{ id: 'TYR', name: 'TYROSINE', type: 'l-peptide linking' },
|
||||
{ id: 'ASP', name: 'ASPARTIC ACID', type: 'l-peptide linking' },
|
||||
{ id: 'GLU', name: 'GLUTAMIC ACID', type: 'l-peptide linking' },
|
||||
{ id: 'THR', name: 'THREONINE', type: 'l-peptide linking' },
|
||||
{ id: 'PRO', name: 'PROLINE', type: 'l-peptide linking' },
|
||||
{ id: 'SEC', name: 'SELENOCYSTEINE', type: 'l-peptide linking' },
|
||||
{ id: 'PYL', name: 'PYRROLYSINE', type: 'l-peptide linking' },
|
||||
|
||||
{ id: 'MSE', name: 'SELENOMETHIONINE', type: 'L-peptide linking' },
|
||||
{ id: 'SEP', name: 'PHOSPHOSERINE', type: 'L-peptide linking' },
|
||||
{ id: 'TPO', name: 'PHOSPHOTHREONINE', type: 'L-peptide linking' },
|
||||
{ id: 'PTR', name: 'O-PHOSPHOTYROSINE', type: 'L-peptide linking' },
|
||||
{ id: 'PCA', name: 'PYROGLUTAMIC ACID', type: 'L-peptide linking' },
|
||||
{ id: 'MSE', name: 'SELENOMETHIONINE', type: 'l-peptide linking' },
|
||||
{ id: 'SEP', name: 'PHOSPHOSERINE', type: 'l-peptide linking' },
|
||||
{ id: 'TPO', name: 'PHOSPHOTHREONINE', type: 'l-peptide linking' },
|
||||
{ id: 'PTR', name: 'O-PHOSPHOTYROSINE', type: 'l-peptide linking' },
|
||||
{ id: 'PCA', name: 'PYROGLUTAMIC ACID', type: 'l-peptide linking' },
|
||||
|
||||
{ id: 'A', name: 'ADENOSINE-5\'-MONOPHOSPHATE', type: 'RNA linking' },
|
||||
{ id: 'C', name: 'CYTIDINE-5\'-MONOPHOSPHATE', type: 'RNA linking' },
|
||||
{ id: 'T', name: 'THYMIDINE-5\'-MONOPHOSPHATE', type: 'RNA linking' },
|
||||
{ id: 'G', name: 'GUANOSINE-5\'-MONOPHOSPHATE', type: 'RNA linking' },
|
||||
{ id: 'I', name: 'INOSINIC ACID', type: 'RNA linking' },
|
||||
{ id: 'U', name: 'URIDINE-5\'-MONOPHOSPHATE', type: 'RNA linking' },
|
||||
{ id: 'A', name: 'ADENOSINE-5\'-MONOPHOSPHATE', type: 'rna linking' },
|
||||
{ id: 'C', name: 'CYTIDINE-5\'-MONOPHOSPHATE', type: 'rna linking' },
|
||||
{ id: 'T', name: 'THYMIDINE-5\'-MONOPHOSPHATE', type: 'rna linking' },
|
||||
{ id: 'G', name: 'GUANOSINE-5\'-MONOPHOSPHATE', type: 'rna linking' },
|
||||
{ id: 'I', name: 'INOSINIC ACID', type: 'rna linking' },
|
||||
{ id: 'U', name: 'URIDINE-5\'-MONOPHOSPHATE', type: 'rna linking' },
|
||||
|
||||
{ id: 'DA', name: '2\'-DEOXYADENOSINE-5\'-MONOPHOSPHATE', type: 'DNA linking' },
|
||||
{ id: 'DC', name: '2\'-DEOXYCYTIDINE-5\'-MONOPHOSPHATE', type: 'DNA linking' },
|
||||
{ id: 'DT', name: 'THYMIDINE-5\'-MONOPHOSPHATE', type: 'DNA linking' },
|
||||
{ id: 'DG', name: '2\'-DEOXYGUANOSINE-5\'-MONOPHOSPHATE', type: 'DNA linking' },
|
||||
{ id: 'DI', name: '2\'-DEOXYINOSINE-5\'-MONOPHOSPHATE', type: 'DNA linking' },
|
||||
{ id: 'DU', name: '2\'-DEOXYURIDINE-5\'-MONOPHOSPHATE', type: 'DNA linking' },
|
||||
{ id: 'DA', name: '2\'-DEOXYADENOSINE-5\'-MONOPHOSPHATE', type: 'dna linking' },
|
||||
{ id: 'DC', name: '2\'-DEOXYCYTIDINE-5\'-MONOPHOSPHATE', type: 'dna linking' },
|
||||
{ id: 'DT', name: 'THYMIDINE-5\'-MONOPHOSPHATE', type: 'dna linking' },
|
||||
{ id: 'DG', name: '2\'-DEOXYGUANOSINE-5\'-MONOPHOSPHATE', type: 'dna linking' },
|
||||
{ id: 'DI', name: '2\'-DEOXYINOSINE-5\'-MONOPHOSPHATE', type: 'dna linking' },
|
||||
{ id: 'DU', name: '2\'-DEOXYURIDINE-5\'-MONOPHOSPHATE', type: 'dna linking' },
|
||||
];
|
||||
components.forEach(c => map.set(c.id, c));
|
||||
return map;
|
||||
@@ -87,12 +87,12 @@ const StandardComponents = (function () {
|
||||
const CharmmIonComponents = (function () {
|
||||
const map = new Map<string, Component>();
|
||||
const components: Component[] = [
|
||||
{ id: 'ZN2', name: 'ZINC ION', type: 'Ion' },
|
||||
{ id: 'SOD', name: 'SODIUM ION', type: 'Ion' },
|
||||
{ id: 'CES', name: 'CESIUM ION', type: 'Ion' },
|
||||
{ id: 'CLA', name: 'CHLORIDE ION', type: 'Ion' },
|
||||
{ id: 'CAL', name: 'CALCIUM ION', type: 'Ion' },
|
||||
{ id: 'POT', name: 'POTASSIUM ION', type: 'Ion' },
|
||||
{ id: 'ZN2', name: 'ZINC ION', type: 'ion' },
|
||||
{ id: 'SOD', name: 'SODIUM ION', type: 'ion' },
|
||||
{ id: 'CES', name: 'CESIUM ION', type: 'ion' },
|
||||
{ id: 'CLA', name: 'CHLORIDE ION', type: 'ion' },
|
||||
{ id: 'CAL', name: 'CALCIUM ION', type: 'ion' },
|
||||
{ id: 'POT', name: 'POTASSIUM ION', type: 'ion' },
|
||||
];
|
||||
components.forEach(c => map.set(c.id, c));
|
||||
return map;
|
||||
@@ -140,9 +140,9 @@ export class ComponentBuilder {
|
||||
if (this.hasAtomIds(atomIds, ProteinAtomIdsList)) {
|
||||
return 'peptide linking';
|
||||
} else if (this.hasAtomIds(atomIds, RnaAtomIdsList)) {
|
||||
return 'RNA linking';
|
||||
return 'rna linking';
|
||||
} else if (this.hasAtomIds(atomIds, DnaAtomIdsList)) {
|
||||
return 'DNA linking';
|
||||
return 'dna linking';
|
||||
} else {
|
||||
return 'other';
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ class FormatRegistry<T> {
|
||||
}
|
||||
|
||||
isApplicable(model: Model) {
|
||||
if (!this.map.has(model.sourceData.kind)) return false;
|
||||
const isApplicable = this.applicable.get(model.sourceData.kind);
|
||||
return isApplicable ? isApplicable(model) : true;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2019-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2019-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* @author David Sehnal <david.sehnal@gmail.com>
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
@@ -39,27 +39,99 @@ export function getAtomSiteTemplate(data: string, count: number) {
|
||||
};
|
||||
}
|
||||
|
||||
export function getAtomSite(sites: AtomSiteTemplate): { [K in keyof mmCIF_Schema['atom_site'] | 'partial_charge']?: CifField } {
|
||||
export function getAtomSite(sites: AtomSiteTemplate, hasTer: boolean): { [K in keyof mmCIF_Schema['atom_site'] | 'partial_charge']?: CifField } {
|
||||
const pdbx_PDB_model_num = CifField.ofStrings(sites.pdbx_PDB_model_num);
|
||||
const auth_asym_id = CifField.ofTokens(sites.auth_asym_id);
|
||||
const auth_seq_id = CifField.ofTokens(sites.auth_seq_id);
|
||||
const auth_atom_id = CifField.ofTokens(sites.auth_atom_id);
|
||||
const auth_comp_id = CifField.ofTokens(sites.auth_comp_id);
|
||||
const id = CifField.ofStrings(sites.id);
|
||||
|
||||
//
|
||||
|
||||
let currModelNum = pdbx_PDB_model_num.str(0);
|
||||
let currAsymId = auth_asym_id.str(0);
|
||||
let currSeqId = auth_seq_id.int(0);
|
||||
let currLabelAsymId = currAsymId;
|
||||
|
||||
const asymIdCounts = new Map<string, number>();
|
||||
const atomIdCounts = new Map<string, number>();
|
||||
|
||||
const labelAsymIds: string[] = [];
|
||||
const labelAtomIds: string[] = [];
|
||||
|
||||
// ensure unique asym ids per model and unique atom ids per seq id
|
||||
for (let i = 0, il = id.rowCount; i < il; ++i) {
|
||||
const modelNum = pdbx_PDB_model_num.str(i);
|
||||
const asymId = auth_asym_id.str(i);
|
||||
const seqId = auth_seq_id.int(i);
|
||||
let atomId = auth_atom_id.str(i);
|
||||
|
||||
let asymIdChanged = false;
|
||||
|
||||
if (modelNum !== currModelNum) {
|
||||
asymIdCounts.clear();
|
||||
atomIdCounts.clear();
|
||||
currModelNum = modelNum;
|
||||
currAsymId = asymId;
|
||||
currSeqId = seqId;
|
||||
asymIdChanged = true;
|
||||
currLabelAsymId = asymId;
|
||||
} else if (currAsymId !== asymId) {
|
||||
atomIdCounts.clear();
|
||||
currAsymId = asymId;
|
||||
currSeqId = seqId;
|
||||
asymIdChanged = true;
|
||||
currLabelAsymId = asymId;
|
||||
} else if (currSeqId !== seqId) {
|
||||
atomIdCounts.clear();
|
||||
currSeqId = seqId;
|
||||
}
|
||||
|
||||
if (asymIdCounts.has(asymId)) {
|
||||
// only change the chains name if there are TER records
|
||||
// otherwise assume repeated chain name use is from interleaved chains
|
||||
if (hasTer && asymIdChanged) {
|
||||
const asymIdCount = asymIdCounts.get(asymId)! + 1;
|
||||
asymIdCounts.set(asymId, asymIdCount);
|
||||
currLabelAsymId = `${asymId}_${asymIdCount}`;
|
||||
}
|
||||
} else {
|
||||
asymIdCounts.set(asymId, 0);
|
||||
}
|
||||
labelAsymIds[i] = currLabelAsymId;
|
||||
|
||||
if (atomIdCounts.has(atomId)) {
|
||||
const atomIdCount = atomIdCounts.get(atomId)! + 1;
|
||||
atomIdCounts.set(atomId, atomIdCount);
|
||||
atomId = `${atomId}_${atomIdCount}`;
|
||||
} else {
|
||||
atomIdCounts.set(atomId, 0);
|
||||
}
|
||||
labelAtomIds[i] = atomId;
|
||||
}
|
||||
|
||||
const labelAsymId = Column.ofStringArray(labelAsymIds);
|
||||
const labelAtomId = Column.ofStringArray(labelAtomIds);
|
||||
|
||||
//
|
||||
|
||||
return {
|
||||
auth_asym_id,
|
||||
auth_atom_id,
|
||||
auth_comp_id,
|
||||
auth_seq_id: CifField.ofTokens(sites.auth_seq_id),
|
||||
auth_seq_id,
|
||||
B_iso_or_equiv: CifField.ofTokens(sites.B_iso_or_equiv),
|
||||
Cartn_x: CifField.ofTokens(sites.Cartn_x),
|
||||
Cartn_y: CifField.ofTokens(sites.Cartn_y),
|
||||
Cartn_z: CifField.ofTokens(sites.Cartn_z),
|
||||
group_PDB: CifField.ofTokens(sites.group_PDB),
|
||||
id: CifField.ofStrings(sites.id),
|
||||
id,
|
||||
|
||||
label_alt_id: CifField.ofTokens(sites.label_alt_id),
|
||||
|
||||
label_asym_id: auth_asym_id,
|
||||
label_atom_id: auth_atom_id,
|
||||
label_asym_id: CifField.ofColumn(labelAsymId),
|
||||
label_atom_id: CifField.ofColumn(labelAtomId),
|
||||
label_comp_id: auth_comp_id,
|
||||
label_seq_id: CifField.ofUndefined(sites.index, Column.Schema.int),
|
||||
label_entity_id: CifField.ofStrings(sites.label_entity_id),
|
||||
@@ -68,7 +140,7 @@ export function getAtomSite(sites: AtomSiteTemplate): { [K in keyof mmCIF_Schema
|
||||
type_symbol: CifField.ofTokens(sites.type_symbol),
|
||||
|
||||
pdbx_PDB_ins_code: CifField.ofTokens(sites.pdbx_PDB_ins_code),
|
||||
pdbx_PDB_model_num: CifField.ofStrings(sites.pdbx_PDB_model_num),
|
||||
pdbx_PDB_model_num,
|
||||
|
||||
partial_charge: CifField.ofTokens(sites.partial_charge)
|
||||
};
|
||||
|
||||
@@ -23,19 +23,19 @@ const HelixTypes: {[k: string]: mmCIF_Schema['struct_conf']['conf_type_id']['T']
|
||||
// Left-handed gamma 8
|
||||
// 2 - 7 ribbon/helix 9
|
||||
// Polyproline 10
|
||||
1: 'HELX_RH_AL_P',
|
||||
2: 'HELX_RH_OM_P',
|
||||
3: 'HELX_RH_PI_P',
|
||||
4: 'HELX_RH_GA_P',
|
||||
5: 'HELX_RH_3T_P',
|
||||
6: 'HELX_LH_AL_P',
|
||||
7: 'HELX_LH_OM_P',
|
||||
8: 'HELX_LH_GA_P',
|
||||
9: 'HELX_RH_27_P', // TODO or left-handed???
|
||||
10: 'HELX_RH_PP_P', // TODO or left-handed???
|
||||
1: 'helx_rh_al_p',
|
||||
2: 'helx_rh_om_p',
|
||||
3: 'helx_rh_pi_p',
|
||||
4: 'helx_rh_ga_p',
|
||||
5: 'helx_rh_3t_p',
|
||||
6: 'helx_lh_al_p',
|
||||
7: 'helx_lh_om_p',
|
||||
8: 'helx_lh_ga_p',
|
||||
9: 'helx_rh_27_p', // TODO or left-handed???
|
||||
10: 'helx_rh_pp_p', // TODO or left-handed???
|
||||
};
|
||||
function getStructConfTypeId(type: string): mmCIF_Schema['struct_conf']['conf_type_id']['T'] {
|
||||
return HelixTypes[type] || 'HELX_P';
|
||||
return HelixTypes[type] || 'helx_p';
|
||||
}
|
||||
|
||||
interface PdbHelix {
|
||||
|
||||
@@ -51,6 +51,7 @@ export async function pdbToMmCif(pdb: PdbFile): Promise<CifFrame> {
|
||||
|
||||
let modelNum = 0, modelStr = '';
|
||||
let conectRange: [number, number] | undefined = undefined;
|
||||
let hasTer = false;
|
||||
|
||||
for (let i = 0, _i = lines.count; i < _i; i++) {
|
||||
let s = indices[2 * i], e = indices[2 * i + 1];
|
||||
@@ -161,6 +162,10 @@ export async function pdbToMmCif(pdb: PdbFile): Promise<CifFrame> {
|
||||
}
|
||||
// TODO: SCALE record => cif.atom_sites.fract_transf_matrix, cif.atom_sites.fract_transf_vector
|
||||
break;
|
||||
case 'T':
|
||||
if (substringStartsWith(data, s, e, 'TER')) {
|
||||
hasTer = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,7 +183,7 @@ export async function pdbToMmCif(pdb: PdbFile): Promise<CifFrame> {
|
||||
atomSite.label_entity_id[i] = entityBuilder.getEntityId(compId, moleculeType, asymIds.value(i));
|
||||
}
|
||||
|
||||
const atom_site = getAtomSite(atomSite);
|
||||
const atom_site = getAtomSite(atomSite, hasTer);
|
||||
if (!isPdbqt) delete atom_site.partial_charge;
|
||||
|
||||
if (conectRange) {
|
||||
|
||||
@@ -73,7 +73,7 @@ export namespace ComponentBond {
|
||||
const nameA = atom_id_1.value(i)!;
|
||||
const nameB = atom_id_2.value(i)!;
|
||||
const order = value_order.value(i)!;
|
||||
const aromatic = pdbx_aromatic_flag.value(i) === 'Y';
|
||||
const aromatic = pdbx_aromatic_flag.value(i) === 'y';
|
||||
|
||||
if (entry.id !== id) {
|
||||
entry = addEntry(id);
|
||||
|
||||
@@ -138,7 +138,7 @@ export namespace StructConn {
|
||||
if (partnerA === undefined || partnerB === undefined) continue;
|
||||
|
||||
const type = conn_type_id.value(i);
|
||||
const orderType = (pdbx_value_order.value(i) || '').toLowerCase();
|
||||
const orderType = (pdbx_value_order.value(i) || '');
|
||||
let flags = BondType.Flag.None;
|
||||
let order = 1;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
/**
|
||||
* Copyright (c) 2018-2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
* Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* @author David Sehnal <david.sehnal@gmail.com>
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
@@ -92,7 +92,7 @@ function addHelices(cat: StructConf, coordinates: CoordinateType, map: Secondary
|
||||
const element: SecondaryStructure.Helix = {
|
||||
kind: 'helix',
|
||||
flags: type,
|
||||
type_id: conf_type_id.valueKind(i) === Column.ValueKind.Present ? conf_type_id.value(i) : 'HELIX_P',
|
||||
type_id: conf_type_id.valueKind(i) === Column.ValueKind.Present ? conf_type_id.value(i) : 'helx_p',
|
||||
helix_class: pdbx_PDB_helix_class.value(i),
|
||||
details: details.valueKind(i) === Column.ValueKind.Present ? details.value(i) : void 0
|
||||
};
|
||||
|
||||
@@ -30,6 +30,7 @@ import { Trajectory, ArrayTrajectory } from '../trajectory';
|
||||
import { Unit } from '../structure';
|
||||
import { SortedArray } from '../../../mol-data/int/sorted-array';
|
||||
import { PolymerType } from './types';
|
||||
import { ModelSecondaryStructure } from '../../../mol-model-formats/structure/property/secondary-structure';
|
||||
|
||||
/**
|
||||
* Interface to the "source data" of the molecule.
|
||||
@@ -99,9 +100,14 @@ export namespace Model {
|
||||
const isIdentity = Column.isIdentity(srcIndex);
|
||||
const srcIndexArray = isIdentity ? void 0 : srcIndex.toArray({ array: Int32Array });
|
||||
const coarseGrained = isCoarseGrained(model);
|
||||
const elementCount = model.atomicHierarchy.atoms._rowCount;
|
||||
|
||||
for (let i = 0, il = frames.length; i < il; ++i) {
|
||||
const f = frames[i];
|
||||
if (f.elementCount !== elementCount) {
|
||||
throw new Error(`Frame element count mismatch, got ${f.elementCount} but expected ${elementCount}.`);
|
||||
}
|
||||
|
||||
const m = {
|
||||
...model,
|
||||
id: UUID.create22(),
|
||||
@@ -297,7 +303,7 @@ export namespace Model {
|
||||
if (!MmcifFormat.is(model.sourceData)) return false;
|
||||
const { db } = model.sourceData.data;
|
||||
for (let i = 0, il = db.database_2.database_id.rowCount; i < il; ++i) {
|
||||
if (db.database_2.database_id.value(i) === 'PDB') return true;
|
||||
if (db.database_2.database_id.value(i) === 'pdb') return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -313,12 +319,15 @@ export namespace Model {
|
||||
}
|
||||
|
||||
export function hasSecondaryStructure(model: Model): boolean {
|
||||
if (!MmcifFormat.is(model.sourceData)) return false;
|
||||
const { db } = model.sourceData.data;
|
||||
return (
|
||||
db.struct_conf.id.isDefined ||
|
||||
db.struct_sheet_range.id.isDefined
|
||||
);
|
||||
if (MmcifFormat.is(model.sourceData)) {
|
||||
const { db } = model.sourceData.data;
|
||||
return (
|
||||
db.struct_conf.id.isDefined ||
|
||||
db.struct_sheet_range.id.isDefined
|
||||
);
|
||||
} else {
|
||||
return ModelSecondaryStructure.Provider.isApplicable(model);
|
||||
}
|
||||
}
|
||||
|
||||
const tmpAngles90 = Vec3.create(1.5707963, 1.5707963, 1.5707963); // in radians
|
||||
|
||||
@@ -17,7 +17,7 @@ export type EntitySubtype = (
|
||||
'lipid' |
|
||||
'peptide-like'
|
||||
)
|
||||
export const EntitySubtype = Column.Schema.Aliased<EntitySubtype>(Column.Schema.Str(''));
|
||||
export const EntitySubtype = Column.Schema.Aliased<EntitySubtype>(Column.Schema.Str());
|
||||
|
||||
export interface Entities {
|
||||
data: mmCIF_Database['entity'],
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user