mirror of
https://github.com/molstar/molstar.git
synced 2026-06-04 21:34:23 +08:00
Compare commits
24 Commits
v1.3.2
...
v2.0.0-dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d527609b6d | ||
|
|
e628f580a7 | ||
|
|
b662179b4d | ||
|
|
fa2b8542bf | ||
|
|
901522f500 | ||
|
|
62b63c1aa5 | ||
|
|
24b36f41da | ||
|
|
c9c890782c | ||
|
|
f2c539ebd8 | ||
|
|
feb922ca91 | ||
|
|
25127bb84b | ||
|
|
8fb01d2157 | ||
|
|
c09357ea75 | ||
|
|
9f2513dae0 | ||
|
|
11a52c0390 | ||
|
|
e955dc7e94 | ||
|
|
c8107272f6 | ||
|
|
fb08fe7545 | ||
|
|
b6f054ea28 | ||
|
|
dc7e85133c | ||
|
|
90cddf4e41 | ||
|
|
2cddbb72a6 | ||
|
|
a16faaac4e | ||
|
|
6c5224f33e |
@@ -31,7 +31,14 @@
|
||||
"no-unsafe-finally": "warn",
|
||||
"no-var": "error",
|
||||
"spaced-comment": "error",
|
||||
"semi": "warn"
|
||||
"semi": "warn",
|
||||
"no-restricted-syntax": [
|
||||
"error",
|
||||
{
|
||||
"selector": "ExportDefaultDeclaration",
|
||||
"message": "Default exports are not allowed"
|
||||
}
|
||||
]
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
|
||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"name": "molstar",
|
||||
"version": "1.3.0",
|
||||
"version": "2.0.0-dev.3",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"version": "1.2.15",
|
||||
"version": "2.0.0-dev.3",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/argparse": "^1.0.38",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "molstar",
|
||||
"version": "1.3.0",
|
||||
"version": "2.0.0-dev.3",
|
||||
"description": "A comprehensive macromolecular library.",
|
||||
"homepage": "https://github.com/molstar/molstar#readme",
|
||||
"repository": {
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
*/
|
||||
|
||||
import '../../mol-util/polyfill';
|
||||
import { createPlugin, DefaultPluginSpec } from '../../mol-plugin';
|
||||
import { createPlugin } from '../../mol-plugin';
|
||||
import { DefaultPluginSpec } from '../../mol-plugin/spec';
|
||||
import './index.html';
|
||||
import { PluginContext } from '../../mol-plugin/context';
|
||||
import { PluginCommands } from '../../mol-plugin/commands';
|
||||
@@ -69,9 +70,10 @@ class Viewer {
|
||||
viewportShowSelectionMode: false,
|
||||
viewportShowAnimation: false,
|
||||
} };
|
||||
const defaultSpec = DefaultPluginSpec();
|
||||
|
||||
const spec: PluginSpec = {
|
||||
actions: [...DefaultPluginSpec.actions],
|
||||
actions: [...defaultSpec.actions],
|
||||
behaviors: [
|
||||
PluginSpec.Behavior(PluginBehaviors.Representation.HighlightLoci, { mark: false }),
|
||||
PluginSpec.Behavior(PluginBehaviors.Representation.DefaultLociLabelProvider),
|
||||
@@ -81,8 +83,8 @@ class Viewer {
|
||||
PluginSpec.Behavior(PluginBehaviors.CustomProps.Interactions),
|
||||
PluginSpec.Behavior(PluginBehaviors.CustomProps.SecondaryStructure),
|
||||
],
|
||||
animations: [...DefaultPluginSpec.animations || []],
|
||||
customParamEditors: DefaultPluginSpec.customParamEditors,
|
||||
animations: [...defaultSpec.animations || []],
|
||||
customParamEditors: defaultSpec.customParamEditors,
|
||||
layout: {
|
||||
initial: {
|
||||
isExpanded: o.layoutIsExpanded,
|
||||
@@ -90,14 +92,14 @@ class Viewer {
|
||||
controlsDisplay: o.layoutControlsDisplay,
|
||||
},
|
||||
controls: {
|
||||
...DefaultPluginSpec.layout && DefaultPluginSpec.layout.controls,
|
||||
...defaultSpec.layout && defaultSpec.layout.controls,
|
||||
top: o.layoutShowSequence ? undefined : 'none',
|
||||
bottom: o.layoutShowLog ? undefined : 'none',
|
||||
left: o.layoutShowLeftPanel ? undefined : 'none',
|
||||
}
|
||||
},
|
||||
components: {
|
||||
...DefaultPluginSpec.components,
|
||||
...defaultSpec.components,
|
||||
remoteState: o.layoutShowRemoteState ? 'default' : 'none',
|
||||
viewport: {
|
||||
view: ViewportComponent
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
*/
|
||||
|
||||
import '../../mol-util/polyfill';
|
||||
import { createPlugin, DefaultPluginSpec } from '../../mol-plugin';
|
||||
import { createPlugin } from '../../mol-plugin';
|
||||
import { DefaultPluginSpec } from '../../mol-plugin/spec';
|
||||
import './index.html';
|
||||
import './embedded.html';
|
||||
import './favicon.ico';
|
||||
@@ -89,15 +90,16 @@ export class Viewer {
|
||||
|
||||
constructor(elementOrId: string | HTMLElement, options: Partial<ViewerOptions> = {}) {
|
||||
const o = { ...DefaultViewerOptions, ...options };
|
||||
const defaultSpec = DefaultPluginSpec();
|
||||
|
||||
const spec: PluginSpec = {
|
||||
actions: [...DefaultPluginSpec.actions],
|
||||
actions: [...defaultSpec.actions],
|
||||
behaviors: [
|
||||
...DefaultPluginSpec.behaviors,
|
||||
...defaultSpec.behaviors,
|
||||
...o.extensions.map(e => Extensions[e]),
|
||||
],
|
||||
animations: [...DefaultPluginSpec.animations || []],
|
||||
customParamEditors: DefaultPluginSpec.customParamEditors,
|
||||
animations: [...defaultSpec.animations || []],
|
||||
customParamEditors: defaultSpec.customParamEditors,
|
||||
customFormats: o?.customFormats,
|
||||
layout: {
|
||||
initial: {
|
||||
@@ -106,14 +108,14 @@ export class Viewer {
|
||||
controlsDisplay: o.layoutControlsDisplay,
|
||||
},
|
||||
controls: {
|
||||
...DefaultPluginSpec.layout && DefaultPluginSpec.layout.controls,
|
||||
...defaultSpec.layout && defaultSpec.layout.controls,
|
||||
top: o.layoutShowSequence ? undefined : 'none',
|
||||
bottom: o.layoutShowLog ? undefined : 'none',
|
||||
left: o.layoutShowLeftPanel ? undefined : 'none',
|
||||
}
|
||||
},
|
||||
components: {
|
||||
...DefaultPluginSpec.components,
|
||||
...defaultSpec.components,
|
||||
remoteState: o.layoutShowRemoteState ? 'default' : 'none',
|
||||
},
|
||||
config: [
|
||||
|
||||
@@ -70,7 +70,7 @@ function classify(name: string, field: CifField): CifWriter.Field {
|
||||
}
|
||||
}
|
||||
|
||||
export default function convert(path: string, asText = false, hints?: EncodingStrategyHint[], filter?: string) {
|
||||
export function convert(path: string, asText = false, hints?: EncodingStrategyHint[], filter?: string) {
|
||||
return Task.create<Uint8Array>('BinaryCIF', async ctx => {
|
||||
const encodingProvider: BinaryEncodingProvider = hints
|
||||
? CifWriter.createEncodingProviderFromJsonConfig(hints)
|
||||
|
||||
@@ -10,7 +10,7 @@ import * as argparse from 'argparse';
|
||||
import * as util from 'util';
|
||||
import * as fs from 'fs';
|
||||
import * as zlib from 'zlib';
|
||||
import convert from './converter';
|
||||
import { convert } from './converter';
|
||||
|
||||
require('util.promisify').shim();
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import fetch from 'node-fetch';
|
||||
|
||||
import { parseCsv } from '../../mol-io/reader/csv/parser';
|
||||
import { CifFrame, CifBlock } from '../../mol-io/reader/cif';
|
||||
import parseText from '../../mol-io/reader/cif/text/parser';
|
||||
import { parseCifText } from '../../mol-io/reader/cif/text/parser';
|
||||
import { generateSchema } from './util/cif-dic';
|
||||
import { generate } from './util/generate';
|
||||
import { Filter, Database } from './util/schema';
|
||||
@@ -28,19 +28,19 @@ function getDicNamespace(block: CifBlock) {
|
||||
|
||||
async function runGenerateSchemaMmcif(name: string, fieldNamesPath: string, typescript = false, out: string, moldbImportPath: string, addAliases: boolean) {
|
||||
await ensureMmcifDicAvailable();
|
||||
const mmcifDic = await parseText(fs.readFileSync(MMCIF_DIC_PATH, 'utf8')).run();
|
||||
const mmcifDic = await parseCifText(fs.readFileSync(MMCIF_DIC_PATH, 'utf8')).run();
|
||||
if (mmcifDic.isError) throw mmcifDic;
|
||||
|
||||
await ensureIhmDicAvailable();
|
||||
const ihmDic = await parseText(fs.readFileSync(IHM_DIC_PATH, 'utf8')).run();
|
||||
const ihmDic = await parseCifText(fs.readFileSync(IHM_DIC_PATH, 'utf8')).run();
|
||||
if (ihmDic.isError) throw ihmDic;
|
||||
|
||||
await ensureCarbBranchDicAvailable();
|
||||
const carbBranchDic = await parseText(fs.readFileSync(CARB_BRANCH_DIC_PATH, 'utf8')).run();
|
||||
const carbBranchDic = await parseCifText(fs.readFileSync(CARB_BRANCH_DIC_PATH, 'utf8')).run();
|
||||
if (carbBranchDic.isError) throw carbBranchDic;
|
||||
|
||||
await ensureCarbCompDicAvailable();
|
||||
const carbCompDic = await parseText(fs.readFileSync(CARB_COMP_DIC_PATH, 'utf8')).run();
|
||||
const carbCompDic = await parseCifText(fs.readFileSync(CARB_COMP_DIC_PATH, 'utf8')).run();
|
||||
if (carbCompDic.isError) throw carbCompDic;
|
||||
|
||||
const mmcifDicVersion = getDicVersion(mmcifDic.result.blocks[0]);
|
||||
@@ -56,7 +56,7 @@ async function runGenerateSchemaMmcif(name: string, fieldNamesPath: string, type
|
||||
|
||||
async function runGenerateSchemaCifCore(name: string, fieldNamesPath: string, typescript = false, out: string, moldbImportPath: string, addAliases: boolean) {
|
||||
await ensureCifCoreDicAvailable();
|
||||
const cifCoreDic = await parseText(fs.readFileSync(CIF_CORE_DIC_PATH, 'utf8')).run();
|
||||
const cifCoreDic = await parseCifText(fs.readFileSync(CIF_CORE_DIC_PATH, 'utf8')).run();
|
||||
if (cifCoreDic.isError) throw cifCoreDic;
|
||||
|
||||
const cifCoreDicVersion = getDicVersion(cifCoreDic.result.blocks[0]);
|
||||
@@ -80,7 +80,7 @@ async function resolveImports(frames: CifFrame[], baseDir: string): Promise<Map<
|
||||
if (!file) continue;
|
||||
if (imports.has(file)) continue;
|
||||
|
||||
const dic = await parseText(fs.readFileSync(path.join(baseDir, file), 'utf8')).run();
|
||||
const dic = await parseCifText(fs.readFileSync(path.join(baseDir, file), 'utf8')).run();
|
||||
if (dic.isError) throw dic;
|
||||
|
||||
imports.set(file, [...dic.result.blocks[0].saveFrames]);
|
||||
@@ -92,7 +92,7 @@ async function resolveImports(frames: CifFrame[], baseDir: string): Promise<Map<
|
||||
}
|
||||
|
||||
async function runGenerateSchemaDic(name: string, dicPath: string, fieldNamesPath: string, typescript = false, out: string, moldbImportPath: string, addAliases: boolean) {
|
||||
const dic = await parseText(fs.readFileSync(dicPath, 'utf8')).run();
|
||||
const dic = await parseCifText(fs.readFileSync(dicPath, 'utf8')).run();
|
||||
if (dic.isError) throw dic;
|
||||
|
||||
const dicVersion = getDicVersion(dic.result.blocks[0]);
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
|
||||
import { SphericalBasisOrder } from '../../extensions/alpha-orbitals/spherical-functions';
|
||||
import { BasisAndOrbitals, CreateOrbitalDensityVolume, CreateOrbitalRepresentation3D, CreateOrbitalVolume, StaticBasisAndOrbitals } from '../../extensions/alpha-orbitals/transforms';
|
||||
import { createPluginAsync, DefaultPluginSpec } from '../../mol-plugin';
|
||||
import { createPluginAsync } from '../../mol-plugin';
|
||||
import { DefaultPluginSpec } from '../../mol-plugin/spec';
|
||||
import { PluginStateObject } from '../../mol-plugin-state/objects';
|
||||
import { PluginConfig } from '../../mol-plugin/config';
|
||||
import { PluginContext } from '../../mol-plugin/context';
|
||||
@@ -53,7 +54,7 @@ export class AlphaOrbitalsExample {
|
||||
|
||||
async init(target: string | HTMLElement) {
|
||||
this.plugin = await createPluginAsync(typeof target === 'string' ? document.getElementById(target)! : target, {
|
||||
...DefaultPluginSpec,
|
||||
...DefaultPluginSpec(),
|
||||
layout: {
|
||||
initial: {
|
||||
isExpanded: false,
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
|
||||
// adjust this number to make the animation faster or slower
|
||||
// requires to "restart" the animation if changed
|
||||
BasicMolStarWrapper.animate.modelIndex.maxFPS = 30;
|
||||
BasicMolStarWrapper.animate.modelIndex.targetFps = 30;
|
||||
|
||||
addControl('Play To End', () => BasicMolStarWrapper.animate.modelIndex.onceForward());
|
||||
addControl('Play To Start', () => BasicMolStarWrapper.animate.modelIndex.onceBackward());
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
|
||||
import { EmptyLoci } from '../../mol-model/loci';
|
||||
import { StructureSelection } from '../../mol-model/structure';
|
||||
import { createPlugin, DefaultPluginSpec } from '../../mol-plugin';
|
||||
import { createPlugin } from '../../mol-plugin';
|
||||
import { DefaultPluginSpec } from '../../mol-plugin/spec';
|
||||
import { AnimateModelIndex } from '../../mol-plugin-state/animation/built-in/model-index';
|
||||
import { BuiltInTrajectoryFormat } from '../../mol-plugin-state/formats/trajectory';
|
||||
import { PluginCommands } from '../../mol-plugin/commands';
|
||||
@@ -28,7 +29,7 @@ class BasicWrapper {
|
||||
|
||||
init(target: string | HTMLElement) {
|
||||
this.plugin = createPlugin(typeof target === 'string' ? document.getElementById(target)! : target, {
|
||||
...DefaultPluginSpec,
|
||||
...DefaultPluginSpec(),
|
||||
layout: {
|
||||
initial: {
|
||||
isExpanded: false,
|
||||
@@ -82,13 +83,17 @@ class BasicWrapper {
|
||||
if (!this.plugin.canvas3d.props.trackball.spin) PluginCommands.Camera.Reset(this.plugin, {});
|
||||
}
|
||||
|
||||
private animateModelIndexTargetFps() {
|
||||
return Math.max(1, this.animate.modelIndex.targetFps | 0);
|
||||
}
|
||||
|
||||
animate = {
|
||||
modelIndex: {
|
||||
maxFPS: 8,
|
||||
onceForward: () => { this.plugin.managers.animation.play(AnimateModelIndex, { maxFPS: Math.max(0.5, this.animate.modelIndex.maxFPS | 0), mode: { name: 'once', params: { direction: 'forward' } } }); },
|
||||
onceBackward: () => { this.plugin.managers.animation.play(AnimateModelIndex, { maxFPS: Math.max(0.5, this.animate.modelIndex.maxFPS | 0), mode: { name: 'once', params: { direction: 'backward' } } }); },
|
||||
palindrome: () => { this.plugin.managers.animation.play(AnimateModelIndex, { maxFPS: Math.max(0.5, this.animate.modelIndex.maxFPS | 0), mode: { name: 'palindrome', params: {} } }); },
|
||||
loop: () => { this.plugin.managers.animation.play(AnimateModelIndex, { maxFPS: Math.max(0.5, this.animate.modelIndex.maxFPS | 0), mode: { name: 'loop', params: {} } }); },
|
||||
targetFps: 8,
|
||||
onceForward: () => { this.plugin.managers.animation.play(AnimateModelIndex, { duration: { name: 'computed', params: { targetFps: this.animateModelIndexTargetFps() } }, mode: { name: 'once', params: { direction: 'forward' } } }); },
|
||||
onceBackward: () => { this.plugin.managers.animation.play(AnimateModelIndex, { duration: { name: 'computed', params: { targetFps: this.animateModelIndexTargetFps() } }, mode: { name: 'once', params: { direction: 'backward' } } }); },
|
||||
palindrome: () => { this.plugin.managers.animation.play(AnimateModelIndex, { duration: { name: 'computed', params: { targetFps: this.animateModelIndexTargetFps() } }, mode: { name: 'palindrome', params: {} } }); },
|
||||
loop: () => { this.plugin.managers.animation.play(AnimateModelIndex, { duration: { name: 'computed', params: { targetFps: this.animateModelIndexTargetFps() } }, mode: { name: 'loop', params: {} } }); },
|
||||
stop: () => this.plugin.managers.animation.stop()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import { superpose } from '../../mol-model/structure/structure/util/superpositio
|
||||
import { PluginStateObject as PSO } from '../../mol-plugin-state/objects';
|
||||
import { PluginContext } from '../../mol-plugin/context';
|
||||
import { MolScriptBuilder as MS } from '../../mol-script/language/builder';
|
||||
import Expression from '../../mol-script/language/expression';
|
||||
import { Expression } from '../../mol-script/language/expression';
|
||||
import { compile } from '../../mol-script/runtime/query/compiler';
|
||||
import { StateObjectRef } from '../../mol-state';
|
||||
import { BuiltInTrajectoryFormat } from '../../mol-plugin-state/formats/trajectory';
|
||||
|
||||
@@ -9,7 +9,7 @@ import { CifWriter } from '../../mol-io/writer/cif';
|
||||
import * as S from './schemas';
|
||||
// import { getCategoryInstanceProvider } from './utils'
|
||||
|
||||
export default function create(allData: any) {
|
||||
export function createMapping(allData: any) {
|
||||
const mols = Object.keys(allData);
|
||||
const enc = CifWriter.createEncoder();
|
||||
enc.startDataBlock(mols[0]);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
import express from 'express';
|
||||
import fetch from 'node-fetch';
|
||||
import createMapping from './mapping';
|
||||
import { createMapping } from './mapping';
|
||||
|
||||
async function getMappings(id: string) {
|
||||
const data = await fetch(`https://www.ebi.ac.uk/pdbe/api/mappings/${id}`);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
import fetch from 'node-fetch';
|
||||
import createMapping from './mapping';
|
||||
import { createMapping } from './mapping';
|
||||
|
||||
(async function () {
|
||||
const data = await fetch('https://www.ebi.ac.uk/pdbe/api/mappings/1tqn?pretty=true');
|
||||
|
||||
@@ -12,18 +12,18 @@
|
||||
}
|
||||
#app {
|
||||
position: absolute;
|
||||
left: 160px;
|
||||
top: 100px;
|
||||
width: 600px;
|
||||
height: 600px;
|
||||
border: 1px solid #ccc;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#controls {
|
||||
position: absolute;
|
||||
width: 150px;
|
||||
top: 100px;
|
||||
left: 780px;
|
||||
bottom: 100px;
|
||||
right: 50px;
|
||||
z-index: 10;
|
||||
font-family: sans-serif;
|
||||
font-size: smaller;
|
||||
}
|
||||
|
||||
#controls > button {
|
||||
@@ -46,13 +46,13 @@
|
||||
<div id="app"></div>
|
||||
<script>
|
||||
LightingDemo.init('app')
|
||||
LightingDemo.load({ url: 'https://files.rcsb.org/download/1M07.cif', assemblyId: '1' })
|
||||
LightingDemo.load({ url: 'https://models.rcsb.org/4KTC.bcif', assemblyId: '1' }, 5, 1.3)
|
||||
|
||||
addHeader('Example PDB IDs');
|
||||
addControl('1M07', () => LightingDemo.load({ url: 'https://files.rcsb.org/download/1M07.cif', assemblyId: '1' }));
|
||||
addControl('6HY0', () => LightingDemo.load({ url: 'https://files.rcsb.org/download/6HY0.cif', assemblyId: '1' }));
|
||||
addControl('6QVK', () => LightingDemo.load({ url: 'https://files.rcsb.org/download/6QVK.cif', assemblyId: '1' }));
|
||||
addControl('1RB8', () => LightingDemo.load({ url: 'https://files.rcsb.org/download/1RB8.cif', assemblyId: '1' }));
|
||||
addControl('4KTC', () => LightingDemo.load({ url: 'https://models.rcsb.org/4KTC.bcif', assemblyId: '1' }, 5, 1.3));
|
||||
addControl('5FJ5', () => LightingDemo.load({ url: 'https://models.rcsb.org/5FJ5.bcif', assemblyId: '1' }, 8, 1.8));
|
||||
addControl('1UPN', () => LightingDemo.load({ url: 'https://models.rcsb.org/1UPN.bcif', assemblyId: '1' }, 7, 1.6));
|
||||
addControl('1RB8', () => LightingDemo.load({ url: 'https://models.rcsb.org/1RB8.bcif', assemblyId: '1' }, 6, 1.3));
|
||||
|
||||
addSeparator()
|
||||
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
*/
|
||||
|
||||
import { Canvas3DProps } from '../../mol-canvas3d/canvas3d';
|
||||
import { createPlugin, DefaultPluginSpec } from '../../mol-plugin';
|
||||
import { createPlugin } from '../../mol-plugin';
|
||||
import { DefaultPluginSpec } from '../../mol-plugin/spec';
|
||||
import { BuiltInTrajectoryFormat } from '../../mol-plugin-state/formats/trajectory';
|
||||
import { PluginCommands } from '../../mol-plugin/commands';
|
||||
import { PluginContext } from '../../mol-plugin/context';
|
||||
@@ -24,12 +25,11 @@ const Canvas3DPresets = {
|
||||
mode: 'temporal' as Canvas3DProps['multiSample']['mode']
|
||||
},
|
||||
postprocessing: {
|
||||
occlusion: { name: 'on', params: { samples: 64, radius: 8, bias: 1.0, blurKernelSize: 13 } },
|
||||
outline: { name: 'on', params: { scale: 1, threshold: 0.33 } }
|
||||
occlusion: { name: 'on', params: { samples: 32, radius: 6, bias: 1.4, blurKernelSize: 15 } },
|
||||
outline: { name: 'on', params: { scale: 1, threshold: 0.1 } }
|
||||
},
|
||||
renderer: {
|
||||
ambientIntensity: 1,
|
||||
lightIntensity: 0,
|
||||
style: { name: 'flat', params: {} }
|
||||
}
|
||||
},
|
||||
occlusion: <Preset> {
|
||||
@@ -37,12 +37,11 @@ const Canvas3DPresets = {
|
||||
mode: 'temporal' as Canvas3DProps['multiSample']['mode']
|
||||
},
|
||||
postprocessing: {
|
||||
occlusion: { name: 'on', params: { samples: 64, radius: 8, bias: 1.0, blurKernelSize: 13 } },
|
||||
occlusion: { name: 'on', params: { samples: 32, radius: 6, bias: 1.4, blurKernelSize: 15 } },
|
||||
outline: { name: 'off', params: { } }
|
||||
},
|
||||
renderer: {
|
||||
ambientIntensity: 0.4,
|
||||
lightIntensity: 0.6,
|
||||
style: { name: 'matte', params: {} }
|
||||
}
|
||||
},
|
||||
standard: <Preset> {
|
||||
@@ -54,20 +53,24 @@ const Canvas3DPresets = {
|
||||
outline: { name: 'off', params: { } }
|
||||
},
|
||||
renderer: {
|
||||
ambientIntensity: 0.4,
|
||||
lightIntensity: 0.6,
|
||||
style: { name: 'matte', params: {} }
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
type Canvas3DPreset = keyof typeof Canvas3DPresets
|
||||
|
||||
class LightingDemo {
|
||||
plugin: PluginContext;
|
||||
|
||||
private radius = 5;
|
||||
private bias = 1.1;
|
||||
private preset: Canvas3DPreset = 'illustrative';
|
||||
|
||||
init(target: string | HTMLElement) {
|
||||
this.plugin = createPlugin(typeof target === 'string' ? document.getElementById(target)! : target, {
|
||||
...DefaultPluginSpec,
|
||||
...DefaultPluginSpec(),
|
||||
layout: {
|
||||
initial: {
|
||||
isExpanded: false,
|
||||
@@ -82,6 +85,10 @@ class LightingDemo {
|
||||
|
||||
setPreset(preset: Canvas3DPreset) {
|
||||
const props = Canvas3DPresets[preset];
|
||||
if (props.postprocessing.occlusion?.name === 'on') {
|
||||
props.postprocessing.occlusion.params.radius = this.radius;
|
||||
props.postprocessing.occlusion.params.bias = this.bias;
|
||||
}
|
||||
PluginCommands.Canvas3D.SetSettings(this.plugin, { settings: {
|
||||
...props,
|
||||
multiSample: {
|
||||
@@ -99,7 +106,7 @@ class LightingDemo {
|
||||
}});
|
||||
}
|
||||
|
||||
async load({ url, format = 'mmcif', isBinary = false, assemblyId = '' }: LoadParams) {
|
||||
async load({ url, format = 'mmcif', isBinary = true, assemblyId = '' }: LoadParams, radius: number, bias: number) {
|
||||
await this.plugin.clear();
|
||||
|
||||
const data = await this.plugin.builders.data.download({ url: Asset.Url(url), isBinary }, { state: { isGhost: true } });
|
||||
@@ -111,7 +118,11 @@ class LightingDemo {
|
||||
if (polymer) await this.plugin.builders.structure.representation.addRepresentation(polymer, { type: 'spacefill', color: 'illustrative' });
|
||||
|
||||
const ligand = await this.plugin.builders.structure.tryCreateComponentStatic(structure, 'ligand');
|
||||
if (ligand) await this.plugin.builders.structure.representation.addRepresentation(ligand, { type: 'ball-and-stick' });
|
||||
if (ligand) await this.plugin.builders.structure.representation.addRepresentation(ligand, { type: 'ball-and-stick', color: 'element-symbol', colorParams: { carbonColor: { name: 'element-symbol', params: {} } } });
|
||||
|
||||
this.radius = radius;
|
||||
this.bias = bias;
|
||||
this.setPreset(this.preset);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@
|
||||
|
||||
// adjust this number to make the animation faster or slower
|
||||
// requires to "restart" the animation if changed
|
||||
PluginWrapper.animate.modelIndex.maxFPS = 30;
|
||||
PluginWrapper.animate.modelIndex.targetFps = 30;
|
||||
|
||||
addControl('Play To End', () => PluginWrapper.animate.modelIndex.onceForward());
|
||||
addControl('Play To Start', () => PluginWrapper.animate.modelIndex.onceBackward());
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
|
||||
import * as ReactDOM from 'react-dom';
|
||||
import { Canvas3DProps, DefaultCanvas3DParams } from '../../mol-canvas3d/canvas3d';
|
||||
import { createPlugin, DefaultPluginSpec } from '../../mol-plugin';
|
||||
import { createPlugin } from '../../mol-plugin';
|
||||
import { DefaultPluginSpec } from '../../mol-plugin/spec';
|
||||
import { AnimateModelIndex } from '../../mol-plugin-state/animation/built-in/model-index';
|
||||
import { createStructureRepresentationParams } from '../../mol-plugin-state/helpers/structure-representation-params';
|
||||
import { PluginStateObject, PluginStateObject as PSO } from '../../mol-plugin-state/objects';
|
||||
@@ -46,7 +47,7 @@ class MolStarProteopediaWrapper {
|
||||
customColorList?: number[]
|
||||
}) {
|
||||
this.plugin = createPlugin(typeof target === 'string' ? document.getElementById(target)! : target, {
|
||||
...DefaultPluginSpec,
|
||||
...DefaultPluginSpec(),
|
||||
animations: [
|
||||
AnimateModelIndex
|
||||
],
|
||||
@@ -271,13 +272,17 @@ class MolStarProteopediaWrapper {
|
||||
resetPosition: () => PluginCommands.Camera.Reset(this.plugin, { })
|
||||
}
|
||||
|
||||
private animateModelIndexTargetFps() {
|
||||
return Math.max(1, this.animate.modelIndex.targetFps | 0);
|
||||
}
|
||||
|
||||
animate = {
|
||||
modelIndex: {
|
||||
maxFPS: 8,
|
||||
onceForward: () => { this.plugin.managers.animation.play(AnimateModelIndex, { maxFPS: Math.max(0.5, this.animate.modelIndex.maxFPS | 0), mode: { name: 'once', params: { direction: 'forward' } } }); },
|
||||
onceBackward: () => { this.plugin.managers.animation.play(AnimateModelIndex, { maxFPS: Math.max(0.5, this.animate.modelIndex.maxFPS | 0), mode: { name: 'once', params: { direction: 'backward' } } }); },
|
||||
palindrome: () => { this.plugin.managers.animation.play(AnimateModelIndex, { maxFPS: Math.max(0.5, this.animate.modelIndex.maxFPS | 0), mode: { name: 'palindrome', params: {} } }); },
|
||||
loop: () => { this.plugin.managers.animation.play(AnimateModelIndex, { maxFPS: Math.max(0.5, this.animate.modelIndex.maxFPS | 0), mode: { name: 'loop', params: {} } }); },
|
||||
targetFps: 8,
|
||||
onceForward: () => { this.plugin.managers.animation.play(AnimateModelIndex, { duration: { name: 'computed', params: { targetFps: this.animateModelIndexTargetFps() } }, mode: { name: 'once', params: { direction: 'forward' } } }); },
|
||||
onceBackward: () => { this.plugin.managers.animation.play(AnimateModelIndex, { duration: { name: 'computed', params: { targetFps: this.animateModelIndexTargetFps() } }, mode: { name: 'once', params: { direction: 'backward' } } }); },
|
||||
palindrome: () => { this.plugin.managers.animation.play(AnimateModelIndex, { duration: { name: 'computed', params: { targetFps: this.animateModelIndexTargetFps() } }, mode: { name: 'palindrome', params: {} } }); },
|
||||
loop: () => { this.plugin.managers.animation.play(AnimateModelIndex, { duration: { name: 'computed', params: { targetFps: this.animateModelIndexTargetFps() } }, mode: { name: 'loop', params: {} } }); },
|
||||
stop: () => this.plugin.managers.animation.stop()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,13 +54,13 @@ export function computeANVIL(structure: Structure, props: ANVILProps) {
|
||||
});
|
||||
}
|
||||
|
||||
const l = StructureElement.Location.create(void 0);
|
||||
|
||||
const centroidHelper = new CentroidHelper();
|
||||
function initialize(structure: Structure, props: ANVILProps): ANVILContext {
|
||||
const l = StructureElement.Location.create(structure);
|
||||
const { label_atom_id, x, y, z } = StructureProperties.atom;
|
||||
const elementCount = structure.polymerResidueCount;
|
||||
centroidHelper.reset();
|
||||
l.structure = structure;
|
||||
|
||||
let offsets = new Int32Array(elementCount);
|
||||
let exposed = new Array<boolean>(elementCount);
|
||||
@@ -328,6 +328,7 @@ namespace HphobHphil {
|
||||
const testPoint = Vec3();
|
||||
export function filtered(ctx: ANVILContext, label_comp_id: StructureElement.Property<string>, filter?: (test: Vec3) => boolean): HphobHphil {
|
||||
const { offsets, exposed, structure } = ctx;
|
||||
const l = StructureElement.Location.create(structure);
|
||||
const { x, y, z } = StructureProperties.atom;
|
||||
let hphob = 0;
|
||||
let hphil = 0;
|
||||
|
||||
@@ -15,7 +15,7 @@ import { AccessibleSurfaceAreaProvider } from '../../mol-model-props/computed/ac
|
||||
import { Vec3 } from '../../mol-math/linear-algebra';
|
||||
import { QuerySymbolRuntime } from '../../mol-script/runtime/query/base';
|
||||
import { CustomPropSymbol } from '../../mol-script/language/symbol';
|
||||
import Type from '../../mol-script/language/type';
|
||||
import { Type } from '../../mol-script/language/type';
|
||||
|
||||
export const MembraneOrientationParams = {
|
||||
...ANVILParams
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* @author David Sehnal <david.sehnal@gmail.com>
|
||||
*/
|
||||
|
||||
import msgpackDecode from '../../mol-io/common/msgpack/decode';
|
||||
import { decodeMsgPack } from '../../mol-io/common/msgpack/decode';
|
||||
import { PluginContext } from '../../mol-plugin/context';
|
||||
import { Task } from '../../mol-task';
|
||||
import { inflate } from '../../mol-util/zip/zip';
|
||||
@@ -41,7 +41,7 @@ export async function getG3dHeader(ctx: PluginContext, urlOrData: string | Uint8
|
||||
for (; last >= 0; last--) {
|
||||
if (data[last] !== 0) break;
|
||||
}
|
||||
const header = msgpackDecode(data.slice(0, last + 1));
|
||||
const header = decodeMsgPack(data.slice(0, last + 1));
|
||||
return header;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ export async function getG3dDataBlock(ctx: PluginContext, header: G3dHeader, url
|
||||
return {
|
||||
header,
|
||||
resolution,
|
||||
data: msgpackDecode(unzipped)
|
||||
data: decodeMsgPack(unzipped)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ import { MoleculeType } from '../../mol-model/structure/model/types';
|
||||
import { LociLabelProvider } from '../../mol-plugin-state/manager/loci-label';
|
||||
import { MolScriptBuilder as MS } from '../../mol-script/language/builder';
|
||||
import { CustomPropSymbol } from '../../mol-script/language/symbol';
|
||||
import Type from '../../mol-script/language/type';
|
||||
import { Type } from '../../mol-script/language/type';
|
||||
import { QuerySymbolRuntime } from '../../mol-script/runtime/query/base';
|
||||
import { RuntimeContext, Task } from '../../mol-task';
|
||||
import { objectForEach } from '../../mol-util/object';
|
||||
|
||||
@@ -13,7 +13,7 @@ import { Model, ResidueIndex, Unit, IndexedCustomProperty } from '../../../mol-m
|
||||
import { residueIdFields } from '../../../mol-model/structure/export/categories/atom_site';
|
||||
import { StructureElement, CifExportContext, Structure } from '../../../mol-model/structure/structure';
|
||||
import { CustomPropSymbol } from '../../../mol-script/language/symbol';
|
||||
import Type from '../../../mol-script/language/type';
|
||||
import { Type } from '../../../mol-script/language/type';
|
||||
import { QuerySymbolRuntime } from '../../../mol-script/runtime/query/compiler';
|
||||
import { ParamDefinition as PD } from '../../../mol-util/param-definition';
|
||||
import { arraySetAdd } from '../../../mol-util/array';
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
import { AssemblySymmetryQuery, AssemblySymmetryQueryVariables } from '../graphql/types';
|
||||
import query from '../graphql/symmetry.gql';
|
||||
import { symmetry_gql } from '../graphql/symmetry.gql';
|
||||
|
||||
import { ParamDefinition as PD } from '../../../mol-util/param-definition';
|
||||
import { Structure, Model, StructureSelection, QueryContext } from '../../../mol-model/structure';
|
||||
@@ -66,7 +66,7 @@ export namespace AssemblySymmetry {
|
||||
assembly_id: structure.units[0].conformation.operator.assembly?.id || '',
|
||||
entry_id: structure.units[0].model.entryId
|
||||
};
|
||||
const result = await client.request(ctx.runtime, query, variables);
|
||||
const result = await client.request(ctx.runtime, symmetry_gql, variables);
|
||||
let value: AssemblySymmetryDataValue = [];
|
||||
|
||||
if (!result.data.assembly?.rcsb_struct_symmetry) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export default /* GraphQL */ `
|
||||
export const symmetry_gql = /* GraphQL */ `
|
||||
query AssemblySymmetry($assembly_id: String!, $entry_id: String!) {
|
||||
assembly(assembly_id: $assembly_id, entry_id: $entry_id) {
|
||||
rcsb_struct_symmetry {
|
||||
|
||||
@@ -19,7 +19,7 @@ import { equalEps } from '../../../mol-math/linear-algebra/3d/common';
|
||||
import { Vec3 } from '../../../mol-math/linear-algebra';
|
||||
import { QuerySymbolRuntime } from '../../../mol-script/runtime/query/compiler';
|
||||
import { CustomPropSymbol } from '../../../mol-script/language/symbol';
|
||||
import Type from '../../../mol-script/language/type';
|
||||
import { Type } from '../../../mol-script/language/type';
|
||||
import { Asset } from '../../../mol-util/assets';
|
||||
import { CustomPropertyDescriptor } from '../../../mol-model/custom-property';
|
||||
|
||||
|
||||
@@ -8,14 +8,14 @@
|
||||
import { BehaviorSubject, Subscription } from 'rxjs';
|
||||
import { now } from '../mol-util/now';
|
||||
import { Vec3, Vec2 } from '../mol-math/linear-algebra';
|
||||
import InputObserver, { ModifiersKeys, ButtonsType } from '../mol-util/input/input-observer';
|
||||
import Renderer, { RendererStats, RendererParams } from '../mol-gl/renderer';
|
||||
import { InputObserver, ModifiersKeys, ButtonsType } from '../mol-util/input/input-observer';
|
||||
import { Renderer, RendererStats, RendererParams } from '../mol-gl/renderer';
|
||||
import { GraphicsRenderObject } from '../mol-gl/render-object';
|
||||
import { TrackballControls, TrackballControlsParams } from './controls/trackball';
|
||||
import { Viewport } from './camera/util';
|
||||
import { createContext, WebGLContext, getGLContext } from '../mol-gl/webgl/context';
|
||||
import { Representation } from '../mol-repr/representation';
|
||||
import Scene from '../mol-gl/scene';
|
||||
import { Scene } from '../mol-gl/scene';
|
||||
import { PickingId } from '../mol-geo/geometry/picking';
|
||||
import { MarkerAction } from '../mol-util/marker-action';
|
||||
import { Loci, EmptyLoci, isEmptyLoci } from '../mol-model/loci';
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
import { Quat, Vec2, Vec3, EPSILON } from '../../mol-math/linear-algebra';
|
||||
import { Viewport } from '../camera/util';
|
||||
import InputObserver, { DragInput, WheelInput, PinchInput, ButtonsType, ModifiersKeys } from '../../mol-util/input/input-observer';
|
||||
import { InputObserver, DragInput, WheelInput, PinchInput, ButtonsType, ModifiersKeys } from '../../mol-util/input/input-observer';
|
||||
import { ParamDefinition as PD } from '../../mol-util/param-definition';
|
||||
import { Camera } from '../camera';
|
||||
import { absMax } from '../../mol-math/misc';
|
||||
|
||||
@@ -9,7 +9,7 @@ import { MeshBuilder } from '../../mol-geo/geometry/mesh/mesh-builder';
|
||||
import { addSphere } from '../../mol-geo/geometry/mesh/builder/sphere';
|
||||
import { Mesh } from '../../mol-geo/geometry/mesh/mesh';
|
||||
import { ParamDefinition as PD } from '../../mol-util/param-definition';
|
||||
import Scene from '../../mol-gl/scene';
|
||||
import { Scene } from '../../mol-gl/scene';
|
||||
import { WebGLContext } from '../../mol-gl/webgl/context';
|
||||
import { Sphere3D } from '../../mol-math/geometry';
|
||||
import { Color } from '../../mol-util/color';
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
import { WebGLContext } from '../../mol-gl/webgl/context';
|
||||
import Scene from '../../mol-gl/scene';
|
||||
import { Scene } from '../../mol-gl/scene';
|
||||
import { Camera, ICamera } from '../camera';
|
||||
import { MeshBuilder } from '../../mol-geo/geometry/mesh/mesh-builder';
|
||||
import { Vec3, Mat4 } from '../../mol-math/linear-algebra';
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
import { WebGLContext } from '../../mol-gl/webgl/context';
|
||||
import Scene from '../../mol-gl/scene';
|
||||
import { Scene } from '../../mol-gl/scene';
|
||||
import { MeshBuilder } from '../../mol-geo/geometry/mesh/mesh-builder';
|
||||
import { Vec3, Mat4, Mat3 } from '../../mol-math/linear-algebra';
|
||||
import { addSphere } from '../../mol-geo/geometry/mesh/builder/sphere';
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
*/
|
||||
|
||||
import Scene from '../../mol-gl/scene';
|
||||
import { Scene } from '../../mol-gl/scene';
|
||||
import { WebGLContext } from '../../mol-gl/webgl/context';
|
||||
import { ParamDefinition as PD } from '../../mol-util/param-definition';
|
||||
import { BoundingSphereHelper, DebugHelperParams } from './bounding-sphere-helper';
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
import { PickingId } from '../../mol-geo/geometry/picking';
|
||||
import { Representation } from '../../mol-repr/representation';
|
||||
import InputObserver, { ModifiersKeys, ButtonsType } from '../../mol-util/input/input-observer';
|
||||
import { InputObserver, ModifiersKeys, ButtonsType } from '../../mol-util/input/input-observer';
|
||||
import { RxEventHelper } from '../../mol-util/rx-event-helper';
|
||||
import { Vec2, Vec3 } from '../../mol-math/linear-algebra';
|
||||
import { Camera } from '../camera';
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
|
||||
import { WebGLContext } from '../../mol-gl/webgl/context';
|
||||
import { createNullRenderTarget, RenderTarget } from '../../mol-gl/webgl/render-target';
|
||||
import Renderer from '../../mol-gl/renderer';
|
||||
import Scene from '../../mol-gl/scene';
|
||||
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';
|
||||
@@ -20,8 +20,8 @@ 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 { quad_vert } from '../../mol-gl/shader/quad.vert';
|
||||
import { depthMerge_frag } from '../../mol-gl/shader/depth-merge.frag';
|
||||
import { copy_frag } from '../../mol-gl/shader/copy.frag';
|
||||
import { StereoCamera } from '../camera/stereo';
|
||||
import { WboitPass } from './wboit';
|
||||
|
||||
@@ -14,8 +14,8 @@ import { Texture } from '../../mol-gl/webgl/texture';
|
||||
import { Vec2 } from '../../mol-math/linear-algebra';
|
||||
import { ValueCell } from '../../mol-util';
|
||||
import { ParamDefinition as PD } from '../../mol-util/param-definition';
|
||||
import quad_vert from '../../mol-gl/shader/quad.vert';
|
||||
import fxaa_frag from '../../mol-gl/shader/fxaa.frag';
|
||||
import { quad_vert } from '../../mol-gl/shader/quad.vert';
|
||||
import { fxaa_frag } from '../../mol-gl/shader/fxaa.frag';
|
||||
import { Viewport } from '../camera/util';
|
||||
import { RenderTarget } from '../../mol-gl/webgl/render-target';
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
|
||||
import { WebGLContext } from '../../mol-gl/webgl/context';
|
||||
import { RenderTarget } from '../../mol-gl/webgl/render-target';
|
||||
import Renderer from '../../mol-gl/renderer';
|
||||
import Scene from '../../mol-gl/scene';
|
||||
import { Renderer } from '../../mol-gl/renderer';
|
||||
import { Scene } from '../../mol-gl/scene';
|
||||
import { ParamDefinition as PD } from '../../mol-util/param-definition';
|
||||
import { DrawPass } from './draw';
|
||||
import { PostprocessingParams } from './postprocessing';
|
||||
|
||||
@@ -18,13 +18,13 @@ import { RenderTarget } from '../../mol-gl/webgl/render-target';
|
||||
import { Camera } from '../../mol-canvas3d/camera';
|
||||
import { PostprocessingProps } from './postprocessing';
|
||||
import { DrawPass } from './draw';
|
||||
import Renderer from '../../mol-gl/renderer';
|
||||
import Scene from '../../mol-gl/scene';
|
||||
import { Renderer } from '../../mol-gl/renderer';
|
||||
import { Scene } from '../../mol-gl/scene';
|
||||
import { Helper } from '../helper/helper';
|
||||
import { StereoCamera } from '../camera/stereo';
|
||||
|
||||
import quad_vert from '../../mol-gl/shader/quad.vert';
|
||||
import compose_frag from '../../mol-gl/shader/compose.frag';
|
||||
import { quad_vert } from '../../mol-gl/shader/quad.vert';
|
||||
import { compose_frag } from '../../mol-gl/shader/compose.frag';
|
||||
|
||||
const ComposeSchema = {
|
||||
...QuadSchema,
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
*/
|
||||
|
||||
import { PickingId } from '../../mol-geo/geometry/picking';
|
||||
import Renderer from '../../mol-gl/renderer';
|
||||
import Scene from '../../mol-gl/scene';
|
||||
import { 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';
|
||||
|
||||
@@ -18,11 +18,11 @@ import { ParamDefinition as PD } from '../../mol-util/param-definition';
|
||||
import { RenderTarget } from '../../mol-gl/webgl/render-target';
|
||||
import { DrawPass } from './draw';
|
||||
import { ICamera } from '../../mol-canvas3d/camera';
|
||||
import quad_vert from '../../mol-gl/shader/quad.vert';
|
||||
import outlines_frag from '../../mol-gl/shader/outlines.frag';
|
||||
import ssao_frag from '../../mol-gl/shader/ssao.frag';
|
||||
import ssao_blur_frag from '../../mol-gl/shader/ssao-blur.frag';
|
||||
import postprocessing_frag from '../../mol-gl/shader/postprocessing.frag';
|
||||
import { quad_vert } from '../../mol-gl/shader/quad.vert';
|
||||
import { outlines_frag } from '../../mol-gl/shader/outlines.frag';
|
||||
import { ssao_frag } from '../../mol-gl/shader/ssao.frag';
|
||||
import { ssaoBlur_frag } from '../../mol-gl/shader/ssao-blur.frag';
|
||||
import { postprocessing_frag } from '../../mol-gl/shader/postprocessing.frag';
|
||||
import { Framebuffer } from '../../mol-gl/webgl/framebuffer';
|
||||
import { Color } from '../../mol-util/color';
|
||||
import { FxaaParams, FxaaPass } from './fxaa';
|
||||
@@ -143,7 +143,7 @@ function getSsaoBlurRenderable(ctx: WebGLContext, ssaoDepthTexture: Texture, dir
|
||||
};
|
||||
|
||||
const schema = { ...SsaoBlurSchema };
|
||||
const shaderCode = ShaderCode('ssao_blur', quad_vert, ssao_blur_frag);
|
||||
const shaderCode = ShaderCode('ssao_blur', quad_vert, ssaoBlur_frag);
|
||||
const renderItem = createComputeRenderItem(ctx, 'triangles', shaderCode, schema, values);
|
||||
|
||||
return createComputeRenderable(renderItem, values);
|
||||
|
||||
@@ -13,8 +13,8 @@ import { WebGLContext } from '../../mol-gl/webgl/context';
|
||||
import { createComputeRenderItem } from '../../mol-gl/webgl/render-item';
|
||||
import { Texture } from '../../mol-gl/webgl/texture';
|
||||
import { ValueCell } from '../../mol-util';
|
||||
import quad_vert from '../../mol-gl/shader/quad.vert';
|
||||
import evaluate_wboit_frag from '../../mol-gl/shader/evaluate-wboit.frag';
|
||||
import { quad_vert } from '../../mol-gl/shader/quad.vert';
|
||||
import { evaluateWboit_frag } from '../../mol-gl/shader/evaluate-wboit.frag';
|
||||
import { Framebuffer } from '../../mol-gl/webgl/framebuffer';
|
||||
import { Vec2 } from '../../mol-math/linear-algebra';
|
||||
import { isDebugMode } from '../../mol-util/debug';
|
||||
@@ -25,7 +25,7 @@ const EvaluateWboitSchema = {
|
||||
tWboitB: TextureSpec('texture', 'rgba', 'float', 'nearest'),
|
||||
uTexSize: UniformSpec('v2'),
|
||||
};
|
||||
const EvaluateWboitShaderCode = ShaderCode('evaluate-wboit', quad_vert, evaluate_wboit_frag);
|
||||
const EvaluateWboitShaderCode = ShaderCode('evaluate-wboit', quad_vert, evaluateWboit_frag);
|
||||
type EvaluateWboitRenderable = ComputeRenderable<Values<typeof EvaluateWboitSchema>>
|
||||
|
||||
function getEvaluateWboitRenderable(ctx: WebGLContext, wboitATexture: Texture, wboitBTexture: Texture): EvaluateWboitRenderable {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* @author David Sehnal <david.sehnal@gmail.com>
|
||||
*/
|
||||
|
||||
import Iterator from '../iterator';
|
||||
import { Iterator } from '../iterator';
|
||||
|
||||
function iteratorToArray<T>(it: Iterator<T>): T[] {
|
||||
const ret = [];
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
*/
|
||||
|
||||
import Database from './db/database';
|
||||
import Table from './db/table';
|
||||
import Column from './db/column';
|
||||
import { Database } from './db/database';
|
||||
import { Table } from './db/table';
|
||||
import { Column } from './db/column';
|
||||
import * as ColumnHelpers from './db/column-helpers';
|
||||
|
||||
type DatabaseCollection<T extends Database.Schema> = { [name: string]: Database<T> }
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
*/
|
||||
|
||||
import * as ColumnHelpers from '../column-helpers';
|
||||
import Column from '../column';
|
||||
import Table from '../table';
|
||||
import { Column } from '../column';
|
||||
import { Table } from '../table';
|
||||
|
||||
describe('column', () => {
|
||||
const cc = Column.ofConst(10, 2, Column.Schema.int);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* @author David Sehnal <david.sehnal@gmail.com>
|
||||
*/
|
||||
|
||||
import Column from './column';
|
||||
import { Column } from './column';
|
||||
|
||||
export function getArrayBounds(rowCount: number, params?: Column.ToArrayParams<any>) {
|
||||
const start = params && typeof params.start !== 'undefined' ? Math.max(Math.min(params.start, rowCount - 1), 0) : 0;
|
||||
|
||||
@@ -230,7 +230,7 @@ namespace Column {
|
||||
}
|
||||
}
|
||||
|
||||
export default Column;
|
||||
export { Column };
|
||||
|
||||
function createFirstIndexMapOfColumn<T>(c: Column<T>): Map<T, number> {
|
||||
const map = new Map<T, number>();
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* @author David Sehnal <david.sehnal@gmail.com>
|
||||
*/
|
||||
|
||||
import Table from './table';
|
||||
import { Table } from './table';
|
||||
|
||||
/** A collection of tables */
|
||||
type Database<Schema extends Database.Schema> = {
|
||||
@@ -41,4 +41,4 @@ namespace Database {
|
||||
}
|
||||
}
|
||||
|
||||
export default Database;
|
||||
export { Database };
|
||||
@@ -4,7 +4,7 @@
|
||||
* @author David Sehnal <david.sehnal@gmail.com>
|
||||
*/
|
||||
|
||||
import Column from './column';
|
||||
import { Column } from './column';
|
||||
import { sortArray } from '../util/sort';
|
||||
import { StringBuilder } from '../../mol-util';
|
||||
|
||||
@@ -280,4 +280,4 @@ namespace Table {
|
||||
}
|
||||
}
|
||||
|
||||
export default Table;
|
||||
export { Table };
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
import * as DB from './db';
|
||||
import * as Int from './int';
|
||||
import Iterator from './iterator';
|
||||
import { Iterator } from './iterator';
|
||||
import * as Util from './util';
|
||||
import * as Generic from './generic';
|
||||
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
* @author David Sehnal <david.sehnal@gmail.com>
|
||||
*/
|
||||
|
||||
import Interval from './int/interval';
|
||||
import OrderedSet from './int/ordered-set';
|
||||
import Segmentation from './int/segmentation';
|
||||
import SortedArray from './int/sorted-array';
|
||||
import Tuple from './int/tuple';
|
||||
import LinkedIndex from './int/linked-index';
|
||||
import IntMap from './int/map';
|
||||
import Iterator from './iterator';
|
||||
import { Interval } from './int/interval';
|
||||
import { OrderedSet } from './int/ordered-set';
|
||||
import { Segmentation } from './int/segmentation';
|
||||
import { SortedArray } from './int/sorted-array';
|
||||
import { IntTuple as Tuple } from './int/tuple';
|
||||
import { LinkedIndex } from './int/linked-index';
|
||||
import { IntMap } from './int/map';
|
||||
import { Iterator } from './iterator';
|
||||
|
||||
export { Interval, OrderedSet, Segmentation, SortedArray, Tuple, LinkedIndex, IntMap, Iterator };
|
||||
@@ -4,7 +4,7 @@
|
||||
* @author David Sehnal <david.sehnal@gmail.com>
|
||||
*/
|
||||
|
||||
import Interval from '../interval';
|
||||
import { Interval } from '../interval';
|
||||
|
||||
describe('interval', () => {
|
||||
function testI(name: string, a: Interval, b: Interval) {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* @author David Sehnal <david.sehnal@gmail.com>
|
||||
*/
|
||||
|
||||
import LinkedIndex from '../linked-index';
|
||||
import { LinkedIndex } from '../linked-index';
|
||||
|
||||
describe('linked-index', () => {
|
||||
it('initial state', () => {
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
* @author David Sehnal <david.sehnal@gmail.com>
|
||||
*/
|
||||
|
||||
import OrderedSet from '../ordered-set';
|
||||
import Interval from '../interval';
|
||||
import SortedArray from '../sorted-array';
|
||||
import { OrderedSet } from '../ordered-set';
|
||||
import { Interval } from '../interval';
|
||||
import { SortedArray } from '../sorted-array';
|
||||
|
||||
describe('ordered set', () => {
|
||||
function ordSetToArray(set: OrderedSet) {
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
* @author David Sehnal <david.sehnal@gmail.com>
|
||||
*/
|
||||
|
||||
import OrderedSet from '../ordered-set';
|
||||
import Interval from '../interval';
|
||||
import Segmentation from '../segmentation';
|
||||
import { OrderedSet } from '../ordered-set';
|
||||
import { Interval } from '../interval';
|
||||
import { Segmentation } from '../segmentation';
|
||||
|
||||
describe('segments', () => {
|
||||
const data = OrderedSet.ofSortedArray([4, 9, 10, 11, 14, 15, 16]);
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
* @author David Sehnal <david.sehnal@gmail.com>
|
||||
*/
|
||||
|
||||
import Interval from '../interval';
|
||||
import SortedArray from '../sorted-array';
|
||||
import { Interval } from '../interval';
|
||||
import { SortedArray } from '../sorted-array';
|
||||
|
||||
describe('sortedArray', () => {
|
||||
function testI(name: string, a: Interval, b: Interval) {
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
*/
|
||||
|
||||
import SortedRanges from '../sorted-ranges';
|
||||
import OrderedSet from '../ordered-set';
|
||||
import SortedArray from '../sorted-array';
|
||||
import { SortedRanges } from '../sorted-ranges';
|
||||
import { OrderedSet } from '../ordered-set';
|
||||
import { SortedArray } from '../sorted-array';
|
||||
|
||||
describe('rangesArray', () => {
|
||||
function test(name: string, a: any, b: any) {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* @author David Sehnal <david.sehnal@gmail.com>
|
||||
*/
|
||||
|
||||
import IntTuple from '../tuple';
|
||||
import { IntTuple } from '../tuple';
|
||||
|
||||
describe('int pair', () => {
|
||||
it('works', () => {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* @author David Sehnal <david.sehnal@gmail.com>
|
||||
*/
|
||||
|
||||
import Tuple from '../tuple';
|
||||
import { IntTuple as Tuple } from '../tuple';
|
||||
|
||||
export const Empty = Tuple.Zero;
|
||||
export function ofRange(min: number, max: number) { return max < min ? Tuple.create(min, min) : Tuple.create(min, max + 1); }
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
* @author David Sehnal <david.sehnal@gmail.com>
|
||||
*/
|
||||
|
||||
import S from '../sorted-array';
|
||||
import I from '../interval';
|
||||
import { SortedArray as S } from '../sorted-array';
|
||||
import { Interval as I } from '../interval';
|
||||
|
||||
type OrderedSetImpl = I | S
|
||||
type Nums = ArrayLike<number>
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
* @author David Sehnal <david.sehnal@gmail.com>
|
||||
*/
|
||||
|
||||
import Iterator from '../../iterator';
|
||||
import OrderedSet from '../ordered-set';
|
||||
import Interval from '../interval';
|
||||
import SortedArray from '../sorted-array';
|
||||
import Segs from '../segmentation';
|
||||
import { Iterator } from '../../iterator';
|
||||
import { OrderedSet } from '../ordered-set';
|
||||
import { Interval } from '../interval';
|
||||
import { SortedArray } from '../sorted-array';
|
||||
import { Segmentation as Segs } from '../segmentation';
|
||||
|
||||
interface Segmentation {
|
||||
/** Segments stored as a sorted array */
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
import { sortArray, hash3, hash4, createRangeArray } from '../../util';
|
||||
import Interval from '../interval';
|
||||
import { Interval } from '../interval';
|
||||
|
||||
type Nums = ArrayLike<number>
|
||||
|
||||
|
||||
@@ -60,4 +60,4 @@ namespace Interval {
|
||||
/** Interval describing a range [min, max] of values */
|
||||
interface Interval<T extends number = number> { '@type': 'int-interval' }
|
||||
|
||||
export default Interval;
|
||||
export { Interval };
|
||||
@@ -55,4 +55,4 @@ class LinkedIndexImpl implements LinkedIndex {
|
||||
}
|
||||
}
|
||||
|
||||
export default LinkedIndex;
|
||||
export { LinkedIndex };
|
||||
@@ -58,4 +58,4 @@ namespace IntMap {
|
||||
}
|
||||
}
|
||||
|
||||
export default IntMap;
|
||||
export { IntMap };
|
||||
@@ -5,8 +5,8 @@
|
||||
*/
|
||||
|
||||
import * as Base from './impl/ordered-set';
|
||||
import Interval from './interval';
|
||||
import SortedArray from './sorted-array';
|
||||
import { Interval } from './interval';
|
||||
import { SortedArray } from './sorted-array';
|
||||
|
||||
namespace OrderedSet {
|
||||
export const Empty: OrderedSet = Base.Empty as any;
|
||||
@@ -82,4 +82,4 @@ namespace OrderedSet {
|
||||
|
||||
type OrderedSet<T extends number = number> = SortedArray<T> | Interval<T>
|
||||
|
||||
export default OrderedSet;
|
||||
export { OrderedSet };
|
||||
@@ -4,8 +4,8 @@
|
||||
* @author David Sehnal <david.sehnal@gmail.com>
|
||||
*/
|
||||
|
||||
import Interval from './interval';
|
||||
import OrderedSet from './ordered-set';
|
||||
import { Interval } from './interval';
|
||||
import { OrderedSet } from './ordered-set';
|
||||
import * as Impl from './impl/segmentation';
|
||||
|
||||
namespace Segmentation {
|
||||
@@ -33,4 +33,4 @@ interface Segmentation<T extends number = number, I extends number = number> {
|
||||
readonly count: number
|
||||
}
|
||||
|
||||
export default Segmentation;
|
||||
export { Segmentation };
|
||||
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
import * as Impl from './impl/sorted-array';
|
||||
import Interval from './interval';
|
||||
import { Interval } from './interval';
|
||||
|
||||
namespace SortedArray {
|
||||
export const Empty: SortedArray = Impl.Empty as any;
|
||||
@@ -54,4 +54,4 @@ namespace SortedArray {
|
||||
|
||||
interface SortedArray<T extends number = number> extends ArrayLike<T> { '@type': 'int-sorted-array' }
|
||||
|
||||
export default SortedArray;
|
||||
export { SortedArray };
|
||||
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
import { Segmentation, OrderedSet, SortedArray, Interval } from '../int';
|
||||
import _Iterator from '../iterator';
|
||||
import { Iterator as _Iterator } from '../iterator';
|
||||
|
||||
/** Pairs of min and max indices of sorted, non-overlapping ranges */
|
||||
type SortedRanges<T extends number = number> = SortedArray<T>
|
||||
@@ -115,4 +115,4 @@ namespace SortedRanges {
|
||||
}
|
||||
}
|
||||
|
||||
export default SortedRanges;
|
||||
export { SortedRanges };
|
||||
@@ -80,4 +80,4 @@ namespace IntTuple {
|
||||
}
|
||||
}
|
||||
|
||||
export default IntTuple;
|
||||
export { IntTuple };
|
||||
@@ -117,4 +117,4 @@ namespace Iterator {
|
||||
}
|
||||
}
|
||||
|
||||
export default Iterator;
|
||||
export { Iterator };
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
// adpated from https://github.com/dankogai/js-combinatorics, MIT 2013-2016 Dan Kogai
|
||||
|
||||
import Iterator from '../iterator';
|
||||
import { Iterator } from '../iterator';
|
||||
|
||||
function P(m: number, n: number) {
|
||||
let p = 1;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
*/
|
||||
|
||||
import Iterator from '../iterator';
|
||||
import { Iterator } from '../iterator';
|
||||
import { OrderedSet, Interval, Segmentation } from '../int';
|
||||
|
||||
/** Emits a segment of length one for each element in the interval that is also in the set */
|
||||
|
||||
@@ -10,14 +10,14 @@ import { Camera } from '../../mol-canvas3d/camera';
|
||||
import { Vec3, Mat4, Vec4 } from '../../mol-math/linear-algebra';
|
||||
import { ValueCell } from '../../mol-util';
|
||||
|
||||
import Renderer from '../renderer';
|
||||
import { Renderer } from '../renderer';
|
||||
import { createValueColor } from '../../mol-geo/geometry/color-data';
|
||||
import { createValueSize } from '../../mol-geo/geometry/size-data';
|
||||
import { createContext } from '../webgl/context';
|
||||
import { RenderableState } from '../renderable';
|
||||
import { createRenderObject } from '../render-object';
|
||||
import { PointsValues } from '../renderable/points';
|
||||
import Scene from '../scene';
|
||||
import { Scene } from '../scene';
|
||||
import { createEmptyMarkers } from '../../mol-geo/geometry/marker-data';
|
||||
import { fillSerial } from '../../mol-util/array';
|
||||
import { Color } from '../../mol-util/color';
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
import { RenderableSchema, Values, UnboxedValues, UniformSpec, TextureSpec, DefineSpec, RenderableValues } from '../renderable/schema';
|
||||
import { WebGLContext } from '../webgl/context';
|
||||
import { getRegularGrid3dDelta, RegularGrid3d } from '../../mol-math/geometry/common';
|
||||
import shader_template from '../shader/util/grid3d-template.frag';
|
||||
import quad_vert from '../shader/quad.vert';
|
||||
import { grid3dTemplate_frag } from '../shader/util/grid3d-template.frag';
|
||||
import { quad_vert } from '../shader/quad.vert';
|
||||
import { ShaderCode } from '../shader-code';
|
||||
import { UUID, ValueCell } from '../../mol-util';
|
||||
import { objectForEach } from '../../mol-util/object';
|
||||
@@ -74,7 +74,7 @@ export function createGrid3dComputeRenderable<S extends RenderableSchema, P, CS>
|
||||
if (isBound) uniforms.push(`#endif`);
|
||||
});
|
||||
|
||||
const code = shader_template
|
||||
const code = grid3dTemplate_frag
|
||||
.replace('{UNIFORMS}', uniforms.join('\n'))
|
||||
.replace('{UTILS}', spec.utilCode ?? '')
|
||||
.replace('{MAIN}', spec.mainCode)
|
||||
|
||||
@@ -16,8 +16,8 @@ import { Vec2, Vec3 } from '../../../mol-math/linear-algebra';
|
||||
import { getHistopyramidSum } from './sum';
|
||||
import { Framebuffer } from '../../../mol-gl/webgl/framebuffer';
|
||||
import { isPowerOfTwo } from '../../../mol-math/misc';
|
||||
import quad_vert from '../../../mol-gl/shader/quad.vert';
|
||||
import reduction_frag from '../../../mol-gl/shader/histogram-pyramid/reduction.frag';
|
||||
import { quad_vert } from '../../../mol-gl/shader/quad.vert';
|
||||
import { reduction_frag } from '../../../mol-gl/shader/histogram-pyramid/reduction.frag';
|
||||
import { isWebGL2 } from '../../webgl/compat';
|
||||
|
||||
const HistopyramidReductionSchema = {
|
||||
|
||||
@@ -13,8 +13,8 @@ import { ShaderCode } from '../../../mol-gl/shader-code';
|
||||
import { ValueCell } from '../../../mol-util';
|
||||
import { decodeFloatRGB } from '../../../mol-util/float-packing';
|
||||
import { QuadSchema, QuadValues } from '../util';
|
||||
import quad_vert from '../../../mol-gl/shader/quad.vert';
|
||||
import sum_frag from '../../../mol-gl/shader/histogram-pyramid/sum.frag';
|
||||
import { quad_vert } from '../../../mol-gl/shader/quad.vert';
|
||||
import { sum_frag } from '../../../mol-gl/shader/histogram-pyramid/sum.frag';
|
||||
import { isWebGL2 } from '../../webgl/compat';
|
||||
|
||||
const HistopyramidSumSchema = {
|
||||
|
||||
@@ -14,8 +14,8 @@ import { ValueCell } from '../../../mol-util';
|
||||
import { Vec3, Vec2 } from '../../../mol-math/linear-algebra';
|
||||
import { QuadSchema, QuadValues } from '../util';
|
||||
import { getTriCount } from './tables';
|
||||
import quad_vert from '../../../mol-gl/shader/quad.vert';
|
||||
import active_voxels_frag from '../../../mol-gl/shader/marching-cubes/active-voxels.frag';
|
||||
import { quad_vert } from '../../../mol-gl/shader/quad.vert';
|
||||
import { activeVoxels_frag } from '../../../mol-gl/shader/marching-cubes/active-voxels.frag';
|
||||
|
||||
const ActiveVoxelsSchema = {
|
||||
...QuadSchema,
|
||||
@@ -65,7 +65,7 @@ function createActiveVoxelsRenderable(ctx: WebGLContext, volumeData: Texture, gr
|
||||
};
|
||||
|
||||
const schema = { ...ActiveVoxelsSchema };
|
||||
const shaderCode = ShaderCode('active-voxels', quad_vert, active_voxels_frag);
|
||||
const shaderCode = ShaderCode('active-voxels', quad_vert, activeVoxels_frag);
|
||||
const renderItem = createComputeRenderItem(ctx, 'triangles', shaderCode, schema, values);
|
||||
|
||||
return createComputeRenderable(renderItem, values);
|
||||
|
||||
@@ -15,10 +15,11 @@ import { Vec3, Vec2, Mat4 } from '../../../mol-math/linear-algebra';
|
||||
import { QuadSchema, QuadValues } from '../util';
|
||||
import { createHistogramPyramid, HistogramPyramid } from '../histogram-pyramid/reduction';
|
||||
import { getTriIndices } from './tables';
|
||||
import quad_vert from '../../../mol-gl/shader/quad.vert';
|
||||
import isosurface_frag from '../../../mol-gl/shader/marching-cubes/isosurface.frag';
|
||||
import { quad_vert } from '../../../mol-gl/shader/quad.vert';
|
||||
import { isosurface_frag } from '../../../mol-gl/shader/marching-cubes/isosurface.frag';
|
||||
import { calcActiveVoxels } from './active-voxels';
|
||||
import { isWebGL2 } from '../../webgl/compat';
|
||||
import { Scheduler } from '../../../mol-task';
|
||||
|
||||
const IsosurfaceSchema = {
|
||||
...QuadSchema,
|
||||
@@ -185,26 +186,36 @@ export function createIsosurfaceBuffers(ctx: WebGLContext, activeVoxelsBase: Tex
|
||||
gl.clear(gl.COLOR_BUFFER_BIT);
|
||||
renderable.render();
|
||||
|
||||
gl.flush();
|
||||
gl.finish();
|
||||
|
||||
return { vertexTexture, groupTexture, normalTexture, vertexCount: count };
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
export function extractIsosurface(ctx: WebGLContext, volumeData: Texture, gridDim: Vec3, gridTexDim: Vec3, gridTexScale: Vec2, transform: Mat4, isoValue: number, packedGroup: boolean, vertexTexture?: Texture, groupTexture?: Texture, normalTexture?: Texture) {
|
||||
function delay() {
|
||||
return new Promise(r => Scheduler.setImmediate(r));
|
||||
}
|
||||
|
||||
export async function extractIsosurface(ctx: WebGLContext, volumeData: Texture, gridDim: Vec3, gridTexDim: Vec3, gridTexScale: Vec2, transform: Mat4, isoValue: number, packedGroup: boolean, vertexTexture?: Texture, groupTexture?: Texture, normalTexture?: Texture) {
|
||||
// console.time('calcActiveVoxels');
|
||||
const activeVoxelsTex = calcActiveVoxels(ctx, volumeData, gridDim, gridTexDim, isoValue, gridTexScale);
|
||||
// ctx.waitForGpuCommandsCompleteSync();
|
||||
// console.timeEnd('calcActiveVoxels');
|
||||
// apply advanced magic to solve incomplete buffer rendering issue
|
||||
await delay();
|
||||
|
||||
// console.time('createHistogramPyramid');
|
||||
const compacted = createHistogramPyramid(ctx, activeVoxelsTex, gridTexScale, gridTexDim);
|
||||
// apply advanced magic to solve incomplete buffer rendering issue
|
||||
await delay();
|
||||
|
||||
// ctx.waitForGpuCommandsCompleteSync();
|
||||
// console.timeEnd('createHistogramPyramid');
|
||||
|
||||
// console.time('createIsosurfaceBuffers');
|
||||
const gv = createIsosurfaceBuffers(ctx, activeVoxelsTex, volumeData, compacted, gridDim, gridTexDim, transform, isoValue, packedGroup, vertexTexture, groupTexture, normalTexture);
|
||||
// apply advanced magic to solve incomplete buffer rendering issue
|
||||
await delay();
|
||||
|
||||
// ctx.waitForGpuCommandsCompleteSync();
|
||||
// console.timeEnd('createIsosurfaceBuffers');
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
import { Viewport } from '../mol-canvas3d/camera/util';
|
||||
import { ICamera } from '../mol-canvas3d/camera';
|
||||
import Scene from './scene';
|
||||
import { Scene } from './scene';
|
||||
import { WebGLContext } from './webgl/context';
|
||||
import { Mat4, Vec3, Vec4, Vec2, Quat } from '../mol-math/linear-algebra';
|
||||
import { GraphicsRenderable } from './renderable';
|
||||
@@ -678,4 +678,4 @@ namespace Renderer {
|
||||
}
|
||||
}
|
||||
|
||||
export default Renderer;
|
||||
export { Renderer };
|
||||
@@ -247,4 +247,4 @@ namespace Scene {
|
||||
}
|
||||
}
|
||||
|
||||
export default Scene;
|
||||
export { Scene };
|
||||
@@ -35,38 +35,38 @@ export interface ShaderCode {
|
||||
readonly outTypes: FragOutTypes
|
||||
}
|
||||
|
||||
import apply_fog from './shader/chunks/apply-fog.glsl';
|
||||
import apply_interior_color from './shader/chunks/apply-interior-color.glsl';
|
||||
import apply_light_color from './shader/chunks/apply-light-color.glsl';
|
||||
import apply_marker_color from './shader/chunks/apply-marker-color.glsl';
|
||||
import assign_clipping_varying from './shader/chunks/assign-clipping-varying.glsl';
|
||||
import assign_color_varying from './shader/chunks/assign-color-varying.glsl';
|
||||
import assign_group from './shader/chunks/assign-group.glsl';
|
||||
import assign_marker_varying from './shader/chunks/assign-marker-varying.glsl';
|
||||
import assign_material_color from './shader/chunks/assign-material-color.glsl';
|
||||
import assign_position from './shader/chunks/assign-position.glsl';
|
||||
import assign_size from './shader/chunks/assign-size.glsl';
|
||||
import check_picking_alpha from './shader/chunks/check-picking-alpha.glsl';
|
||||
import clip_instance from './shader/chunks/clip-instance.glsl';
|
||||
import clip_pixel from './shader/chunks/clip-pixel.glsl';
|
||||
import color_frag_params from './shader/chunks/color-frag-params.glsl';
|
||||
import color_vert_params from './shader/chunks/color-vert-params.glsl';
|
||||
import common_clip from './shader/chunks/common-clip.glsl';
|
||||
import common_frag_params from './shader/chunks/common-frag-params.glsl';
|
||||
import common_vert_params from './shader/chunks/common-vert-params.glsl';
|
||||
import common from './shader/chunks/common.glsl';
|
||||
import float_to_rgba from './shader/chunks/float-to-rgba.glsl';
|
||||
import light_frag_params from './shader/chunks/light-frag-params.glsl';
|
||||
import matrix_scale from './shader/chunks/matrix-scale.glsl';
|
||||
import normal_frag_params from './shader/chunks/normal-frag-params.glsl';
|
||||
import read_from_texture from './shader/chunks/read-from-texture.glsl';
|
||||
import rgba_to_float from './shader/chunks/rgba-to-float.glsl';
|
||||
import size_vert_params from './shader/chunks/size-vert-params.glsl';
|
||||
import texture3d_from_1d_trilinear from './shader/chunks/texture3d-from-1d-trilinear.glsl';
|
||||
import texture3d_from_2d_linear from './shader/chunks/texture3d-from-2d-linear.glsl';
|
||||
import texture3d_from_2d_nearest from './shader/chunks/texture3d-from-2d-nearest.glsl';
|
||||
import wboit_params from './shader/chunks/wboit-params.glsl';
|
||||
import wboit_write from './shader/chunks/wboit-write.glsl';
|
||||
import { apply_fog } from './shader/chunks/apply-fog.glsl';
|
||||
import { apply_interior_color } from './shader/chunks/apply-interior-color.glsl';
|
||||
import { apply_light_color } from './shader/chunks/apply-light-color.glsl';
|
||||
import { apply_marker_color } from './shader/chunks/apply-marker-color.glsl';
|
||||
import { assign_clipping_varying } from './shader/chunks/assign-clipping-varying.glsl';
|
||||
import { assign_color_varying } from './shader/chunks/assign-color-varying.glsl';
|
||||
import { assign_group } from './shader/chunks/assign-group.glsl';
|
||||
import { assign_marker_varying } from './shader/chunks/assign-marker-varying.glsl';
|
||||
import { assign_material_color } from './shader/chunks/assign-material-color.glsl';
|
||||
import { assign_position } from './shader/chunks/assign-position.glsl';
|
||||
import { assign_size } from './shader/chunks/assign-size.glsl';
|
||||
import { check_picking_alpha } from './shader/chunks/check-picking-alpha.glsl';
|
||||
import { clip_instance } from './shader/chunks/clip-instance.glsl';
|
||||
import { clip_pixel } from './shader/chunks/clip-pixel.glsl';
|
||||
import { color_frag_params } from './shader/chunks/color-frag-params.glsl';
|
||||
import { color_vert_params } from './shader/chunks/color-vert-params.glsl';
|
||||
import { common_clip } from './shader/chunks/common-clip.glsl';
|
||||
import { common_frag_params } from './shader/chunks/common-frag-params.glsl';
|
||||
import { common_vert_params } from './shader/chunks/common-vert-params.glsl';
|
||||
import { common } from './shader/chunks/common.glsl';
|
||||
import { float_to_rgba } from './shader/chunks/float-to-rgba.glsl';
|
||||
import { light_frag_params } from './shader/chunks/light-frag-params.glsl';
|
||||
import { matrix_scale } from './shader/chunks/matrix-scale.glsl';
|
||||
import { normal_frag_params } from './shader/chunks/normal-frag-params.glsl';
|
||||
import { read_from_texture } from './shader/chunks/read-from-texture.glsl';
|
||||
import { rgba_to_float } from './shader/chunks/rgba-to-float.glsl';
|
||||
import { size_vert_params } from './shader/chunks/size-vert-params.glsl';
|
||||
import { texture3d_from_1d_trilinear } from './shader/chunks/texture3d-from-1d-trilinear.glsl';
|
||||
import { texture3d_from_2d_linear } from './shader/chunks/texture3d-from-2d-linear.glsl';
|
||||
import { texture3d_from_2d_nearest } from './shader/chunks/texture3d-from-2d-nearest.glsl';
|
||||
import { wboit_params } from './shader/chunks/wboit-params.glsl';
|
||||
import { wboit_write } from './shader/chunks/wboit-write.glsl';
|
||||
|
||||
const ShaderChunks: { [k: string]: string } = {
|
||||
apply_fog,
|
||||
@@ -127,36 +127,36 @@ export function ShaderCode(name: string, vert: string, frag: string, extensions:
|
||||
|
||||
// Note: `drawBuffers` need to be 'optional' for wboit
|
||||
|
||||
import points_vert from './shader/points.vert';
|
||||
import points_frag from './shader/points.frag';
|
||||
import { points_vert } from './shader/points.vert';
|
||||
import { points_frag } from './shader/points.frag';
|
||||
export const PointsShaderCode = ShaderCode('points', points_vert, points_frag, { drawBuffers: 'optional' });
|
||||
|
||||
import spheres_vert from './shader/spheres.vert';
|
||||
import spheres_frag from './shader/spheres.frag';
|
||||
import { spheres_vert } from './shader/spheres.vert';
|
||||
import { spheres_frag } from './shader/spheres.frag';
|
||||
export const SpheresShaderCode = ShaderCode('spheres', spheres_vert, spheres_frag, { fragDepth: 'required', drawBuffers: 'optional' });
|
||||
|
||||
import cylinders_vert from './shader/cylinders.vert';
|
||||
import cylinders_frag from './shader/cylinders.frag';
|
||||
import { cylinders_vert } from './shader/cylinders.vert';
|
||||
import { cylinders_frag } from './shader/cylinders.frag';
|
||||
export const CylindersShaderCode = ShaderCode('cylinders', cylinders_vert, cylinders_frag, { fragDepth: 'required', drawBuffers: 'optional' });
|
||||
|
||||
import text_vert from './shader/text.vert';
|
||||
import text_frag from './shader/text.frag';
|
||||
import { text_vert }from './shader/text.vert';
|
||||
import { text_frag } from './shader/text.frag';
|
||||
export const TextShaderCode = ShaderCode('text', text_vert, text_frag, { standardDerivatives: 'required', drawBuffers: 'optional' });
|
||||
|
||||
import lines_vert from './shader/lines.vert';
|
||||
import lines_frag from './shader/lines.frag';
|
||||
import { lines_vert } from './shader/lines.vert';
|
||||
import { lines_frag } from './shader/lines.frag';
|
||||
export const LinesShaderCode = ShaderCode('lines', lines_vert, lines_frag, { drawBuffers: 'optional' });
|
||||
|
||||
import mesh_vert from './shader/mesh.vert';
|
||||
import mesh_frag from './shader/mesh.frag';
|
||||
import { mesh_vert } from './shader/mesh.vert';
|
||||
import { mesh_frag } from './shader/mesh.frag';
|
||||
export const MeshShaderCode = ShaderCode('mesh', mesh_vert, mesh_frag, { standardDerivatives: 'optional', drawBuffers: 'optional' });
|
||||
|
||||
import direct_volume_vert from './shader/direct-volume.vert';
|
||||
import direct_volume_frag from './shader/direct-volume.frag';
|
||||
export const DirectVolumeShaderCode = ShaderCode('direct-volume', direct_volume_vert, direct_volume_frag, { fragDepth: 'optional', drawBuffers: 'optional' });
|
||||
import { directVolume_vert } from './shader/direct-volume.vert';
|
||||
import { directVolume_frag } from './shader/direct-volume.frag';
|
||||
export const DirectVolumeShaderCode = ShaderCode('direct-volume', directVolume_vert, directVolume_frag, { fragDepth: 'optional', drawBuffers: 'optional' });
|
||||
|
||||
import image_vert from './shader/image.vert';
|
||||
import image_frag from './shader/image.frag';
|
||||
import { image_vert } from './shader/image.vert';
|
||||
import { image_frag } from './shader/image.frag';
|
||||
export const ImageShaderCode = ShaderCode('image', image_vert, image_frag, { drawBuffers: 'optional' });
|
||||
|
||||
//
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export default `
|
||||
export const apply_fog = `
|
||||
float viewZ = depthToViewZ(uIsOrtho, fragmentDepth, uNear, uFar);
|
||||
float fogFactor = smoothstep(uFogNear, uFogFar, abs(viewZ));
|
||||
float fogAlpha = (1.0 - fogFactor) * gl_FragColor.a;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export default `
|
||||
export const apply_interior_color = `
|
||||
if (interior) {
|
||||
if (uInteriorColorFlag) {
|
||||
gl_FragColor.rgb = uInteriorColor;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* which under the MIT License, Copyright © 2010-2019 three.js authors
|
||||
*/
|
||||
|
||||
export default `
|
||||
export const apply_light_color = `
|
||||
// inputs
|
||||
// - vec4 material
|
||||
// - vec3 vViewPosition
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export default `
|
||||
export const apply_marker_color = `
|
||||
float marker = floor(vMarker * 255.0 + 0.5); // rounding required to work on some cards on win
|
||||
if (marker > 0.1) {
|
||||
if (intMod(marker, 2.0) > 0.1) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export default `
|
||||
export const assign_clipping_varying = `
|
||||
#if dClipObjectCount != 0 && defined(dClipping)
|
||||
vClipping = readFromTexture(tClipping, aInstance * float(uGroupCount) + group, uClippingTexDim).a;
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export default `
|
||||
export const assign_color_varying = `
|
||||
#if defined(dRenderVariant_color)
|
||||
#if defined(dColorType_attribute)
|
||||
vColor.rgb = aColor;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export default `
|
||||
export const assign_group = `
|
||||
#ifdef dGeoTexture
|
||||
float group = decodeFloatRGB(readFromTexture(tGroup, VertexID, uGeoTexDim).rgb);
|
||||
#else
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export default `
|
||||
export const assign_marker_varying = `
|
||||
vMarker = readFromTexture(tMarker, aInstance * float(uGroupCount) + group, uMarkerTexDim).a;
|
||||
`;
|
||||
@@ -1,4 +1,4 @@
|
||||
export default `
|
||||
export const assign_material_color = `
|
||||
#if defined(dRenderVariant_color)
|
||||
#if defined(dColorType_uniform)
|
||||
vec4 material = vec4(uColor, uAlpha);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export default `
|
||||
export const assign_position = `
|
||||
mat4 model = uModel * aTransform;
|
||||
mat4 modelView = uView * model;
|
||||
#ifdef dGeoTexture
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export default `
|
||||
export const assign_size = `
|
||||
#if defined(dSizeType_uniform)
|
||||
float size = uSize;
|
||||
#elif defined(dSizeType_attribute)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export default `
|
||||
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;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export default `
|
||||
export const clip_instance = `
|
||||
#if defined(dClipVariant_instance) && dClipObjectCount != 0
|
||||
int flag = 0;
|
||||
#if defined(dClipping)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export default `
|
||||
export const clip_pixel = `
|
||||
#if defined(dClipVariant_pixel) && dClipObjectCount != 0
|
||||
#if defined(dClipping)
|
||||
int clippingFlag = int(floor(vClipping * 255.0 + 0.5));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export default `
|
||||
export const color_frag_params = `
|
||||
#if defined(dRenderVariant_color)
|
||||
#if defined(dColorType_uniform)
|
||||
uniform vec3 uColor;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export default `
|
||||
export const color_vert_params = `
|
||||
#if defined(dRenderVariant_color)
|
||||
#if defined(dColorType_uniform)
|
||||
uniform vec3 uColor;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
*/
|
||||
|
||||
export default `
|
||||
export const common_clip = `
|
||||
#if dClipObjectCount != 0
|
||||
vec3 quaternionTransform(vec4 q, vec3 v) {
|
||||
vec3 t = 2.0 * cross(q.xyz, v);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export default `
|
||||
export const common_frag_params = `
|
||||
uniform int uObjectId;
|
||||
uniform int uInstanceCount;
|
||||
uniform int uGroupCount;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export default `
|
||||
export const common_vert_params = `
|
||||
uniform mat4 uProjection, uModel, uView;
|
||||
uniform vec3 uCameraPosition;
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user