molstar 3.0.0-dev.7 → 3.0.0-dev.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/viewer/index.html +4 -0
- package/build/viewer/molstar.js +1 -1
- package/lib/apps/viewer/index.d.ts +1 -0
- package/lib/apps/viewer/index.html +4 -0
- package/lib/apps/viewer/index.js +2 -0
- package/lib/commonjs/apps/viewer/index.d.ts +1 -0
- package/lib/commonjs/apps/viewer/index.js +2 -0
- package/lib/commonjs/examples/alpha-orbitals/index.js +1 -1
- package/lib/commonjs/extensions/geo-export/mesh-exporter.js +4 -4
- package/lib/commonjs/extensions/rcsb/assembly-symmetry/behavior.d.ts +2 -2
- package/lib/commonjs/mol-canvas3d/canvas3d.d.ts +1 -1
- package/lib/commonjs/mol-canvas3d/canvas3d.js +33 -29
- package/lib/commonjs/mol-canvas3d/passes/draw.d.ts +13 -1
- package/lib/commonjs/mol-canvas3d/passes/draw.js +16 -15
- package/lib/commonjs/mol-canvas3d/passes/image.js +3 -2
- package/lib/commonjs/mol-canvas3d/passes/marking.js +1 -1
- package/lib/commonjs/mol-canvas3d/passes/multi-sample.d.ts +9 -2
- package/lib/commonjs/mol-canvas3d/passes/multi-sample.js +14 -12
- package/lib/commonjs/mol-canvas3d/passes/pick.js +3 -3
- package/lib/commonjs/mol-geo/geometry/color-data.d.ts +1 -1
- package/lib/commonjs/mol-geo/geometry/color-data.js +22 -0
- package/lib/commonjs/mol-geo/geometry/cylinders/cylinders.js +1 -1
- package/lib/commonjs/mol-geo/geometry/direct-volume/direct-volume.d.ts +5 -38
- package/lib/commonjs/mol-geo/geometry/direct-volume/direct-volume.js +21 -66
- package/lib/commonjs/mol-geo/geometry/direct-volume/transfer-function.d.ts +2 -4
- package/lib/commonjs/mol-geo/geometry/direct-volume/transfer-function.js +4 -7
- package/lib/commonjs/mol-geo/geometry/image/image.js +1 -1
- package/lib/commonjs/mol-geo/geometry/lines/lines.js +1 -1
- package/lib/commonjs/mol-geo/geometry/marker-data.js +13 -5
- package/lib/commonjs/mol-geo/geometry/mesh/mesh.js +1 -1
- package/lib/commonjs/mol-geo/geometry/points/points.js +1 -1
- package/lib/commonjs/mol-geo/geometry/size-data.js +5 -5
- package/lib/commonjs/mol-geo/geometry/spheres/spheres.js +1 -1
- package/lib/commonjs/mol-geo/geometry/text/text.js +1 -1
- package/lib/commonjs/mol-geo/geometry/texture-mesh/texture-mesh.js +1 -1
- package/lib/commonjs/mol-gl/compute/histogram-pyramid/sum.js +2 -2
- package/lib/commonjs/mol-gl/compute/marching-cubes/isosurface.d.ts +2 -2
- package/lib/commonjs/mol-gl/compute/marching-cubes/isosurface.js +10 -9
- package/lib/commonjs/mol-gl/renderable/cylinders.d.ts +1 -0
- package/lib/commonjs/mol-gl/renderable/direct-volume.d.ts +6 -10
- package/lib/commonjs/mol-gl/renderable/direct-volume.js +1 -1
- package/lib/commonjs/mol-gl/renderable/image.d.ts +1 -0
- package/lib/commonjs/mol-gl/renderable/lines.d.ts +1 -0
- package/lib/commonjs/mol-gl/renderable/mesh.d.ts +1 -0
- package/lib/commonjs/mol-gl/renderable/points.d.ts +1 -0
- package/lib/commonjs/mol-gl/renderable/schema.d.ts +1 -0
- package/lib/commonjs/mol-gl/renderable/schema.js +2 -2
- package/lib/commonjs/mol-gl/renderable/spheres.d.ts +1 -0
- package/lib/commonjs/mol-gl/renderable/text.d.ts +1 -0
- package/lib/commonjs/mol-gl/renderable/texture-mesh.d.ts +1 -1
- package/lib/commonjs/mol-gl/renderable/texture-mesh.js +1 -1
- package/lib/commonjs/mol-gl/renderer.js +12 -19
- package/lib/commonjs/mol-gl/shader/chunks/assign-color-varying.glsl.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/assign-color-varying.glsl.js +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/assign-group.glsl.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/assign-group.glsl.js +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/assign-position.glsl.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/assign-position.glsl.js +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/assign-size.glsl.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/assign-size.glsl.js +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/common.glsl.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/common.glsl.js +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/wboit-write.glsl.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/wboit-write.glsl.js +1 -1
- package/lib/commonjs/mol-gl/shader/compute/color-smoothing/accumulate.vert.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/compute/color-smoothing/accumulate.vert.js +1 -1
- package/lib/commonjs/mol-gl/shader/direct-volume.frag.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/direct-volume.frag.js +1 -1
- package/lib/commonjs/mol-gl/shader/gaussian-density.frag.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/gaussian-density.frag.js +1 -1
- package/lib/commonjs/mol-gl/shader/histogram-pyramid/reduction.frag.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/histogram-pyramid/reduction.frag.js +1 -1
- package/lib/commonjs/mol-gl/shader/image.frag.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/image.frag.js +1 -1
- package/lib/commonjs/mol-gl/shader/marching-cubes/isosurface.frag.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/marching-cubes/isosurface.frag.js +1 -1
- package/lib/commonjs/mol-gl/shader/mesh.vert.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/mesh.vert.js +1 -1
- package/lib/commonjs/mol-gl/shader-code.js +1 -1
- package/lib/commonjs/mol-math/geometry/gaussian-density/gpu.js +2 -2
- package/lib/commonjs/mol-plugin/behavior/dynamic/representation.js +4 -6
- package/lib/commonjs/mol-plugin/config.d.ts +0 -1
- package/lib/commonjs/mol-plugin/config.js +4 -25
- package/lib/commonjs/mol-plugin/features.d.ts +9 -0
- package/lib/commonjs/mol-plugin/features.js +38 -0
- package/lib/commonjs/mol-plugin-state/builder/structure/representation-preset.d.ts +4 -4
- package/lib/commonjs/mol-plugin-state/manager/structure/selection.js +3 -1
- package/lib/commonjs/mol-plugin-state/transforms/representation.js +2 -2
- package/lib/commonjs/mol-repr/structure/complex-representation.js +1 -1
- package/lib/commonjs/mol-repr/structure/complex-visual.d.ts +1 -19
- package/lib/commonjs/mol-repr/structure/params.d.ts +1 -19
- package/lib/commonjs/mol-repr/structure/registry.d.ts +1 -19
- package/lib/commonjs/mol-repr/structure/representation/gaussian-surface.js +1 -1
- package/lib/commonjs/mol-repr/structure/representation/gaussian-volume.d.ts +4 -58
- package/lib/commonjs/mol-repr/structure/representation/gaussian-volume.js +2 -7
- package/lib/commonjs/mol-repr/structure/representation/label.js +1 -1
- package/lib/commonjs/mol-repr/structure/representation/molecular-surface.js +1 -1
- package/lib/commonjs/mol-repr/structure/units-representation.js +1 -1
- package/lib/commonjs/mol-repr/structure/units-visual.d.ts +1 -19
- package/lib/commonjs/mol-repr/structure/visual/gaussian-density-volume.d.ts +2 -38
- package/lib/commonjs/mol-repr/structure/visual/gaussian-density-volume.js +8 -6
- package/lib/commonjs/mol-repr/structure/visual/gaussian-surface-mesh.js +11 -8
- package/lib/commonjs/mol-repr/structure/visual/gaussian-surface-wireframe.js +1 -1
- package/lib/commonjs/mol-repr/structure/visual/label-text.js +1 -2
- package/lib/commonjs/mol-repr/structure/visual/molecular-surface-mesh.js +1 -1
- package/lib/commonjs/mol-repr/structure/visual/molecular-surface-wireframe.js +1 -1
- package/lib/commonjs/mol-repr/structure/visual/util/common.d.ts +3 -2
- package/lib/commonjs/mol-repr/structure/visual/util/common.js +2 -5
- package/lib/commonjs/mol-repr/structure/visual/util/gaussian.d.ts +7 -6
- package/lib/commonjs/mol-repr/structure/visual/util/gaussian.js +12 -12
- package/lib/commonjs/mol-repr/structure/visual/util/molecular-surface.d.ts +2 -1
- package/lib/commonjs/mol-repr/structure/visual/util/molecular-surface.js +4 -4
- package/lib/commonjs/mol-repr/volume/direct-volume.d.ts +3 -57
- package/lib/commonjs/mol-repr/volume/direct-volume.js +8 -12
- package/lib/commonjs/mol-repr/volume/isosurface.js +11 -2
- package/lib/commonjs/mol-repr/volume/registry.d.ts +1 -19
- package/lib/commonjs/mol-repr/volume/slice.js +2 -2
- package/lib/commonjs/mol-repr/volume/util.js +2 -2
- package/lib/commonjs/mol-theme/color/volume-value.d.ts +17 -0
- package/lib/commonjs/mol-theme/color/volume-value.js +57 -0
- package/lib/commonjs/mol-theme/color.d.ts +3 -0
- package/lib/commonjs/mol-theme/color.js +2 -0
- package/lib/commonjs/mol-util/number-packing.d.ts +11 -0
- package/lib/commonjs/mol-util/{float-packing.js → number-packing.js} +10 -19
- package/lib/examples/alpha-orbitals/index.js +1 -1
- package/lib/extensions/geo-export/mesh-exporter.js +4 -4
- package/lib/extensions/rcsb/assembly-symmetry/behavior.d.ts +2 -2
- package/lib/mol-canvas3d/canvas3d.d.ts +1 -1
- package/lib/mol-canvas3d/canvas3d.js +33 -29
- package/lib/mol-canvas3d/passes/draw.d.ts +13 -1
- package/lib/mol-canvas3d/passes/draw.js +16 -15
- package/lib/mol-canvas3d/passes/image.js +3 -2
- package/lib/mol-canvas3d/passes/marking.js +1 -1
- package/lib/mol-canvas3d/passes/multi-sample.d.ts +9 -2
- package/lib/mol-canvas3d/passes/multi-sample.js +14 -12
- package/lib/mol-canvas3d/passes/pick.js +2 -2
- package/lib/mol-geo/geometry/color-data.d.ts +1 -1
- package/lib/mol-geo/geometry/color-data.js +22 -0
- package/lib/mol-geo/geometry/cylinders/cylinders.js +1 -1
- package/lib/mol-geo/geometry/direct-volume/direct-volume.d.ts +5 -38
- package/lib/mol-geo/geometry/direct-volume/direct-volume.js +22 -67
- package/lib/mol-geo/geometry/direct-volume/transfer-function.d.ts +2 -4
- package/lib/mol-geo/geometry/direct-volume/transfer-function.js +4 -7
- package/lib/mol-geo/geometry/image/image.js +1 -1
- package/lib/mol-geo/geometry/lines/lines.js +1 -1
- package/lib/mol-geo/geometry/marker-data.js +13 -5
- package/lib/mol-geo/geometry/mesh/mesh.js +1 -1
- package/lib/mol-geo/geometry/points/points.js +1 -1
- package/lib/mol-geo/geometry/size-data.js +5 -5
- package/lib/mol-geo/geometry/spheres/spheres.js +1 -1
- package/lib/mol-geo/geometry/text/text.js +1 -1
- package/lib/mol-geo/geometry/texture-mesh/texture-mesh.js +1 -1
- package/lib/mol-gl/compute/histogram-pyramid/sum.js +2 -2
- package/lib/mol-gl/compute/marching-cubes/isosurface.d.ts +2 -2
- package/lib/mol-gl/compute/marching-cubes/isosurface.js +10 -9
- package/lib/mol-gl/renderable/cylinders.d.ts +1 -0
- package/lib/mol-gl/renderable/direct-volume.d.ts +6 -10
- package/lib/mol-gl/renderable/direct-volume.js +1 -1
- package/lib/mol-gl/renderable/image.d.ts +1 -0
- package/lib/mol-gl/renderable/lines.d.ts +1 -0
- package/lib/mol-gl/renderable/mesh.d.ts +1 -0
- package/lib/mol-gl/renderable/points.d.ts +1 -0
- package/lib/mol-gl/renderable/schema.d.ts +1 -0
- package/lib/mol-gl/renderable/schema.js +2 -2
- package/lib/mol-gl/renderable/spheres.d.ts +1 -0
- package/lib/mol-gl/renderable/text.d.ts +1 -0
- package/lib/mol-gl/renderable/texture-mesh.d.ts +1 -1
- package/lib/mol-gl/renderable/texture-mesh.js +1 -1
- package/lib/mol-gl/renderer.js +12 -19
- package/lib/mol-gl/shader/chunks/assign-color-varying.glsl.d.ts +1 -1
- package/lib/mol-gl/shader/chunks/assign-color-varying.glsl.js +1 -1
- package/lib/mol-gl/shader/chunks/assign-group.glsl.d.ts +1 -1
- package/lib/mol-gl/shader/chunks/assign-group.glsl.js +1 -1
- package/lib/mol-gl/shader/chunks/assign-position.glsl.d.ts +1 -1
- package/lib/mol-gl/shader/chunks/assign-position.glsl.js +1 -1
- package/lib/mol-gl/shader/chunks/assign-size.glsl.d.ts +1 -1
- package/lib/mol-gl/shader/chunks/assign-size.glsl.js +1 -1
- package/lib/mol-gl/shader/chunks/common.glsl.d.ts +1 -1
- package/lib/mol-gl/shader/chunks/common.glsl.js +1 -1
- package/lib/mol-gl/shader/chunks/wboit-write.glsl.d.ts +1 -1
- package/lib/mol-gl/shader/chunks/wboit-write.glsl.js +1 -1
- package/lib/mol-gl/shader/compute/color-smoothing/accumulate.vert.d.ts +1 -1
- package/lib/mol-gl/shader/compute/color-smoothing/accumulate.vert.js +1 -1
- package/lib/mol-gl/shader/direct-volume.frag.d.ts +1 -1
- package/lib/mol-gl/shader/direct-volume.frag.js +1 -1
- package/lib/mol-gl/shader/gaussian-density.frag.d.ts +1 -1
- package/lib/mol-gl/shader/gaussian-density.frag.js +1 -1
- package/lib/mol-gl/shader/histogram-pyramid/reduction.frag.d.ts +1 -1
- package/lib/mol-gl/shader/histogram-pyramid/reduction.frag.js +1 -1
- package/lib/mol-gl/shader/image.frag.d.ts +1 -1
- package/lib/mol-gl/shader/image.frag.js +1 -1
- package/lib/mol-gl/shader/marching-cubes/isosurface.frag.d.ts +1 -1
- package/lib/mol-gl/shader/marching-cubes/isosurface.frag.js +1 -1
- package/lib/mol-gl/shader/mesh.vert.d.ts +1 -1
- package/lib/mol-gl/shader/mesh.vert.js +1 -1
- package/lib/mol-gl/shader-code.js +1 -1
- package/lib/mol-math/geometry/gaussian-density/gpu.js +2 -2
- package/lib/mol-plugin/behavior/dynamic/representation.js +4 -6
- package/lib/mol-plugin/config.d.ts +0 -1
- package/lib/mol-plugin/config.js +3 -23
- package/lib/mol-plugin/features.d.ts +9 -0
- package/lib/mol-plugin/features.js +35 -0
- package/lib/mol-plugin/version.js +2 -2
- package/lib/mol-plugin-state/builder/structure/representation-preset.d.ts +4 -4
- package/lib/mol-plugin-state/manager/structure/selection.js +3 -1
- package/lib/mol-plugin-state/transforms/representation.js +2 -2
- package/lib/mol-repr/structure/complex-representation.js +1 -1
- package/lib/mol-repr/structure/complex-visual.d.ts +1 -19
- package/lib/mol-repr/structure/params.d.ts +1 -19
- package/lib/mol-repr/structure/registry.d.ts +1 -19
- package/lib/mol-repr/structure/representation/gaussian-surface.js +1 -1
- package/lib/mol-repr/structure/representation/gaussian-volume.d.ts +4 -58
- package/lib/mol-repr/structure/representation/gaussian-volume.js +2 -7
- package/lib/mol-repr/structure/representation/label.js +1 -1
- package/lib/mol-repr/structure/representation/molecular-surface.js +1 -1
- package/lib/mol-repr/structure/units-representation.js +1 -1
- package/lib/mol-repr/structure/units-visual.d.ts +1 -19
- package/lib/mol-repr/structure/visual/gaussian-density-volume.d.ts +2 -38
- package/lib/mol-repr/structure/visual/gaussian-density-volume.js +8 -6
- package/lib/mol-repr/structure/visual/gaussian-surface-mesh.js +11 -8
- package/lib/mol-repr/structure/visual/gaussian-surface-wireframe.js +1 -1
- package/lib/mol-repr/structure/visual/label-text.js +1 -2
- package/lib/mol-repr/structure/visual/molecular-surface-mesh.js +1 -1
- package/lib/mol-repr/structure/visual/molecular-surface-wireframe.js +1 -1
- package/lib/mol-repr/structure/visual/util/common.d.ts +3 -2
- package/lib/mol-repr/structure/visual/util/common.js +2 -5
- package/lib/mol-repr/structure/visual/util/gaussian.d.ts +7 -6
- package/lib/mol-repr/structure/visual/util/gaussian.js +12 -12
- package/lib/mol-repr/structure/visual/util/molecular-surface.d.ts +2 -1
- package/lib/mol-repr/structure/visual/util/molecular-surface.js +4 -4
- package/lib/mol-repr/volume/direct-volume.d.ts +3 -57
- package/lib/mol-repr/volume/direct-volume.js +8 -12
- package/lib/mol-repr/volume/isosurface.js +11 -2
- package/lib/mol-repr/volume/registry.d.ts +1 -19
- package/lib/mol-repr/volume/slice.js +2 -2
- package/lib/mol-repr/volume/util.js +2 -2
- package/lib/mol-theme/color/volume-value.d.ts +17 -0
- package/lib/mol-theme/color/volume-value.js +52 -0
- package/lib/mol-theme/color.d.ts +3 -0
- package/lib/mol-theme/color.js +2 -0
- package/lib/mol-util/number-packing.d.ts +11 -0
- package/lib/mol-util/{float-packing.js → number-packing.js} +7 -14
- package/package.json +1 -1
- package/lib/commonjs/mol-util/float-packing.d.ts +0 -15
- package/lib/mol-util/float-packing.d.ts +0 -15
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c) 2018-
|
|
2
|
+
* Copyright (c) 2018-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
3
3
|
*
|
|
4
4
|
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
|
5
5
|
*/
|
|
6
6
|
import { Texture } from '../../../mol-gl/webgl/texture';
|
|
7
7
|
import { Box3D, Sphere3D } from '../../../mol-math/geometry';
|
|
8
|
-
import { Mat4,
|
|
8
|
+
import { Mat4, Vec3, Vec4 } from '../../../mol-math/linear-algebra';
|
|
9
9
|
import { ValueCell } from '../../../mol-util';
|
|
10
10
|
import { ParamDefinition as PD } from '../../../mol-util/param-definition';
|
|
11
11
|
import { GeometryUtils } from '../geometry';
|
|
@@ -24,51 +24,18 @@ export interface DirectVolume {
|
|
|
24
24
|
readonly unitToCartn: ValueCell<Mat4>;
|
|
25
25
|
readonly cartnToUnit: ValueCell<Mat4>;
|
|
26
26
|
readonly packedGroup: ValueCell<boolean>;
|
|
27
|
+
readonly axisOrder: ValueCell<Vec3>;
|
|
27
28
|
/** Bounding sphere of the volume */
|
|
28
29
|
readonly boundingSphere: Sphere3D;
|
|
29
30
|
setBoundingSphere(boundingSphere: Sphere3D): void;
|
|
30
31
|
}
|
|
31
32
|
export declare namespace DirectVolume {
|
|
32
|
-
function create(bbox: Box3D, gridDimension: Vec3, transform: Mat4, unitToCartn: Mat4, cellDim: Vec3, texture: Texture, stats: Grid['stats'], packedGroup: boolean, directVolume?: DirectVolume): DirectVolume;
|
|
33
|
+
function create(bbox: Box3D, gridDimension: Vec3, transform: Mat4, unitToCartn: Mat4, cellDim: Vec3, texture: Texture, stats: Grid['stats'], packedGroup: boolean, axisOrder: Vec3, directVolume?: DirectVolume): DirectVolume;
|
|
33
34
|
function createEmpty(directVolume?: DirectVolume): DirectVolume;
|
|
34
|
-
function createRenderModeParam(stats?: Grid['stats']): PD.Mapped<PD.NamedParams<PD.Normalize<{
|
|
35
|
-
controlPoints: Vec2[];
|
|
36
|
-
list: {
|
|
37
|
-
kind: "set" | "interpolate";
|
|
38
|
-
colors: import("../../../mol-util/color/color").ColorListEntry[];
|
|
39
|
-
};
|
|
40
|
-
}>, "volume"> | PD.NamedParams<PD.Normalize<{
|
|
41
|
-
isoValue: Readonly<{
|
|
42
|
-
kind: "absolute";
|
|
43
|
-
absoluteValue: number;
|
|
44
|
-
}> | Readonly<{
|
|
45
|
-
kind: "relative";
|
|
46
|
-
relativeValue: number;
|
|
47
|
-
}>;
|
|
48
|
-
singleLayer: boolean;
|
|
49
|
-
}>, "isosurface">>;
|
|
50
35
|
const Params: {
|
|
51
|
-
doubleSided: PD.BooleanParam;
|
|
52
|
-
flipSided: PD.BooleanParam;
|
|
53
|
-
flatShaded: PD.BooleanParam;
|
|
54
36
|
ignoreLight: PD.BooleanParam;
|
|
55
37
|
xrayShaded: PD.BooleanParam;
|
|
56
|
-
|
|
57
|
-
controlPoints: Vec2[];
|
|
58
|
-
list: {
|
|
59
|
-
kind: "set" | "interpolate";
|
|
60
|
-
colors: import("../../../mol-util/color/color").ColorListEntry[];
|
|
61
|
-
};
|
|
62
|
-
}>, "volume"> | PD.NamedParams<PD.Normalize<{
|
|
63
|
-
isoValue: Readonly<{
|
|
64
|
-
kind: "absolute";
|
|
65
|
-
absoluteValue: number;
|
|
66
|
-
}> | Readonly<{
|
|
67
|
-
kind: "relative";
|
|
68
|
-
relativeValue: number;
|
|
69
|
-
}>;
|
|
70
|
-
singleLayer: boolean;
|
|
71
|
-
}>, "isosurface">>;
|
|
38
|
+
controlPoints: PD.LineGraph;
|
|
72
39
|
stepsPerCell: PD.Numeric;
|
|
73
40
|
jumpLength: PD.Numeric;
|
|
74
41
|
alpha: PD.Numeric;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Copyright (c) 2018-
|
|
3
|
+
* Copyright (c) 2018-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
4
4
|
*
|
|
5
5
|
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
|
6
6
|
*/
|
|
@@ -24,15 +24,14 @@ var transparency_data_1 = require("../transparency-data");
|
|
|
24
24
|
var transfer_function_1 = require("./transfer-function");
|
|
25
25
|
var clipping_data_1 = require("../clipping-data");
|
|
26
26
|
var volume_1 = require("../../../mol-model/volume");
|
|
27
|
-
var names_1 = require("../../../mol-util/color/names");
|
|
28
27
|
var substance_data_1 = require("../substance-data");
|
|
29
28
|
var VolumeBox = (0, box_1.Box)();
|
|
30
29
|
var DirectVolume;
|
|
31
30
|
(function (DirectVolume) {
|
|
32
|
-
function create(bbox, gridDimension, transform, unitToCartn, cellDim, texture, stats, packedGroup, directVolume) {
|
|
31
|
+
function create(bbox, gridDimension, transform, unitToCartn, cellDim, texture, stats, packedGroup, axisOrder, directVolume) {
|
|
33
32
|
return directVolume ?
|
|
34
|
-
update(bbox, gridDimension, transform, unitToCartn, cellDim, texture, stats, packedGroup, directVolume) :
|
|
35
|
-
fromData(bbox, gridDimension, transform, unitToCartn, cellDim, texture, stats, packedGroup);
|
|
33
|
+
update(bbox, gridDimension, transform, unitToCartn, cellDim, texture, stats, packedGroup, axisOrder, directVolume) :
|
|
34
|
+
fromData(bbox, gridDimension, transform, unitToCartn, cellDim, texture, stats, packedGroup, axisOrder);
|
|
36
35
|
}
|
|
37
36
|
DirectVolume.create = create;
|
|
38
37
|
function hashCode(directVolume) {
|
|
@@ -42,7 +41,7 @@ var DirectVolume;
|
|
|
42
41
|
directVolume.gridStats.ref.version
|
|
43
42
|
]);
|
|
44
43
|
}
|
|
45
|
-
function fromData(bbox, gridDimension, transform, unitToCartn, cellDim, texture, stats, packedGroup) {
|
|
44
|
+
function fromData(bbox, gridDimension, transform, unitToCartn, cellDim, texture, stats, packedGroup, axisOrder) {
|
|
46
45
|
var boundingSphere = (0, geometry_1.Sphere3D)();
|
|
47
46
|
var currentHash = -1;
|
|
48
47
|
var width = texture.getWidth();
|
|
@@ -71,6 +70,7 @@ var DirectVolume;
|
|
|
71
70
|
return boundingSphere;
|
|
72
71
|
},
|
|
73
72
|
packedGroup: mol_util_1.ValueCell.create(packedGroup),
|
|
73
|
+
axisOrder: mol_util_1.ValueCell.create(axisOrder),
|
|
74
74
|
setBoundingSphere: function (sphere) {
|
|
75
75
|
geometry_1.Sphere3D.copy(boundingSphere, sphere);
|
|
76
76
|
currentHash = hashCode(directVolume);
|
|
@@ -78,7 +78,7 @@ var DirectVolume;
|
|
|
78
78
|
};
|
|
79
79
|
return directVolume;
|
|
80
80
|
}
|
|
81
|
-
function update(bbox, gridDimension, transform, unitToCartn, cellDim, texture, stats, packedGroup, directVolume) {
|
|
81
|
+
function update(bbox, gridDimension, transform, unitToCartn, cellDim, texture, stats, packedGroup, axisOrder, directVolume) {
|
|
82
82
|
var width = texture.getWidth();
|
|
83
83
|
var height = texture.getHeight();
|
|
84
84
|
var depth = texture.getDepth();
|
|
@@ -94,6 +94,7 @@ var DirectVolume;
|
|
|
94
94
|
mol_util_1.ValueCell.update(directVolume.unitToCartn, unitToCartn);
|
|
95
95
|
mol_util_1.ValueCell.update(directVolume.cartnToUnit, linear_algebra_1.Mat4.invert((0, linear_algebra_1.Mat4)(), unitToCartn));
|
|
96
96
|
mol_util_1.ValueCell.updateIfChanged(directVolume.packedGroup, packedGroup);
|
|
97
|
+
mol_util_1.ValueCell.updateIfChanged(directVolume.axisOrder, linear_algebra_1.Vec3.fromArray(directVolume.axisOrder.ref.value, axisOrder, 0));
|
|
97
98
|
return directVolume;
|
|
98
99
|
}
|
|
99
100
|
function createEmpty(directVolume) {
|
|
@@ -105,38 +106,14 @@ var DirectVolume;
|
|
|
105
106
|
var texture = (0, texture_1.createNullTexture)();
|
|
106
107
|
var stats = volume_1.Grid.One.stats;
|
|
107
108
|
var packedGroup = false;
|
|
108
|
-
|
|
109
|
+
var axisOrder = linear_algebra_1.Vec3.create(0, 1, 2);
|
|
110
|
+
return create(bbox, gridDimension, transform, unitToCartn, cellDim, texture, stats, packedGroup, axisOrder, directVolume);
|
|
109
111
|
}
|
|
110
112
|
DirectVolume.createEmpty = createEmpty;
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
return param_definition_1.ParamDefinition.MappedStatic('volume', {
|
|
116
|
-
isosurface: param_definition_1.ParamDefinition.Group({
|
|
117
|
-
isoValue: isoValueParam,
|
|
118
|
-
singleLayer: param_definition_1.ParamDefinition.Boolean(false, { isEssential: true }),
|
|
119
|
-
}, { isFlat: true }),
|
|
120
|
-
volume: param_definition_1.ParamDefinition.Group({
|
|
121
|
-
controlPoints: param_definition_1.ParamDefinition.LineGraph([
|
|
122
|
-
linear_algebra_1.Vec2.create(0.19, 0.0), linear_algebra_1.Vec2.create(0.2, 0.05), linear_algebra_1.Vec2.create(0.25, 0.05), linear_algebra_1.Vec2.create(0.26, 0.0),
|
|
123
|
-
linear_algebra_1.Vec2.create(0.79, 0.0), linear_algebra_1.Vec2.create(0.8, 0.05), linear_algebra_1.Vec2.create(0.85, 0.05), linear_algebra_1.Vec2.create(0.86, 0.0),
|
|
124
|
-
]),
|
|
125
|
-
list: param_definition_1.ParamDefinition.ColorList({
|
|
126
|
-
kind: 'interpolate',
|
|
127
|
-
colors: [
|
|
128
|
-
[names_1.ColorNames.white, 0],
|
|
129
|
-
[names_1.ColorNames.red, 0.25],
|
|
130
|
-
[names_1.ColorNames.white, 0.5],
|
|
131
|
-
[names_1.ColorNames.blue, 0.75],
|
|
132
|
-
[names_1.ColorNames.white, 1]
|
|
133
|
-
]
|
|
134
|
-
}, { offsets: true }),
|
|
135
|
-
}, { isFlat: true })
|
|
136
|
-
}, { isEssential: true });
|
|
137
|
-
}
|
|
138
|
-
DirectVolume.createRenderModeParam = createRenderModeParam;
|
|
139
|
-
DirectVolume.Params = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, base_1.BaseGeometry.Params), { doubleSided: param_definition_1.ParamDefinition.Boolean(false, base_1.BaseGeometry.CustomQualityParamInfo), flipSided: param_definition_1.ParamDefinition.Boolean(false, base_1.BaseGeometry.ShadingCategory), flatShaded: param_definition_1.ParamDefinition.Boolean(false, base_1.BaseGeometry.ShadingCategory), ignoreLight: param_definition_1.ParamDefinition.Boolean(false, base_1.BaseGeometry.ShadingCategory), xrayShaded: param_definition_1.ParamDefinition.Boolean(false, base_1.BaseGeometry.ShadingCategory), renderMode: createRenderModeParam(), stepsPerCell: param_definition_1.ParamDefinition.Numeric(5, { min: 1, max: 20, step: 1 }), jumpLength: param_definition_1.ParamDefinition.Numeric(0, { min: 0, max: 20, step: 0.1 }) });
|
|
113
|
+
DirectVolume.Params = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, base_1.BaseGeometry.Params), { ignoreLight: param_definition_1.ParamDefinition.Boolean(false, base_1.BaseGeometry.ShadingCategory), xrayShaded: param_definition_1.ParamDefinition.Boolean(false, base_1.BaseGeometry.ShadingCategory), controlPoints: param_definition_1.ParamDefinition.LineGraph([
|
|
114
|
+
linear_algebra_1.Vec2.create(0.19, 0.0), linear_algebra_1.Vec2.create(0.2, 0.05), linear_algebra_1.Vec2.create(0.25, 0.05), linear_algebra_1.Vec2.create(0.26, 0.0),
|
|
115
|
+
linear_algebra_1.Vec2.create(0.79, 0.0), linear_algebra_1.Vec2.create(0.8, 0.05), linear_algebra_1.Vec2.create(0.85, 0.05), linear_algebra_1.Vec2.create(0.86, 0.0),
|
|
116
|
+
], { isEssential: true }), stepsPerCell: param_definition_1.ParamDefinition.Numeric(3, { min: 1, max: 10, step: 1 }), jumpLength: param_definition_1.ParamDefinition.Numeric(0, { min: 0, max: 20, step: 0.1 }) });
|
|
140
117
|
DirectVolume.Utils = {
|
|
141
118
|
Params: DirectVolume.Params,
|
|
142
119
|
createEmpty: createEmpty,
|
|
@@ -169,12 +146,6 @@ var DirectVolume;
|
|
|
169
146
|
};
|
|
170
147
|
return (0, location_iterator_1.LocationIterator)(groupCount, instanceCount, 1, getLocation);
|
|
171
148
|
}
|
|
172
|
-
function getNormalizedIsoValue(out, isoValue, stats) {
|
|
173
|
-
var min = stats[0], max = stats[1], mean = stats[2], sigma = stats[3];
|
|
174
|
-
var value = volume_1.Volume.IsoValue.toAbsolute(isoValue, { min: min, max: max, mean: mean, sigma: sigma }).absoluteValue;
|
|
175
|
-
linear_algebra_1.Vec2.set(out, (value - min) / (max - min), (0 - min) / (max - min));
|
|
176
|
-
return out;
|
|
177
|
-
}
|
|
178
149
|
function getMaxSteps(gridDim, stepsPerCell) {
|
|
179
150
|
return Math.ceil(linear_algebra_1.Vec3.magnitude(gridDim) * stepsPerCell);
|
|
180
151
|
}
|
|
@@ -199,15 +170,9 @@ var DirectVolume;
|
|
|
199
170
|
var counts = { drawCount: VolumeBox.indices.length, vertexCount: x * y * z, groupCount: groupCount, instanceCount: instanceCount };
|
|
200
171
|
var invariantBoundingSphere = geometry_1.Sphere3D.clone(directVolume.boundingSphere);
|
|
201
172
|
var boundingSphere = (0, util_2.calculateTransformBoundingSphere)(invariantBoundingSphere, transform.aTransform.ref.value, instanceCount);
|
|
202
|
-
var controlPoints =
|
|
203
|
-
var transferTex = (0, transfer_function_1.createTransferFunctionTexture)(controlPoints
|
|
204
|
-
|
|
205
|
-
? props.renderMode.params.isoValue
|
|
206
|
-
: volume_1.Volume.IsoValue.relative(2);
|
|
207
|
-
var singleLayer = props.renderMode.name === 'isosurface'
|
|
208
|
-
? props.renderMode.params.singleLayer
|
|
209
|
-
: false;
|
|
210
|
-
return (0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)({}, color), marker), overpaint), transparency), material), clipping), transform), base_1.BaseGeometry.createValues(props, counts)), { aPosition: mol_util_1.ValueCell.create(VolumeBox.vertices), elements: mol_util_1.ValueCell.create(VolumeBox.indices), boundingSphere: mol_util_1.ValueCell.create(boundingSphere), invariantBoundingSphere: mol_util_1.ValueCell.create(invariantBoundingSphere), uInvariantBoundingSphere: mol_util_1.ValueCell.create(linear_algebra_1.Vec4.ofSphere(invariantBoundingSphere)), uIsoValue: mol_util_1.ValueCell.create(getNormalizedIsoValue((0, linear_algebra_1.Vec2)(), isoValue, directVolume.gridStats.ref.value)), uBboxMin: bboxMin, uBboxMax: bboxMax, uBboxSize: bboxSize, uMaxSteps: mol_util_1.ValueCell.create(getMaxSteps(gridDimension.ref.value, props.stepsPerCell)), uStepScale: mol_util_1.ValueCell.create(getStepScale(directVolume.cellDim.ref.value, props.stepsPerCell)), uJumpLength: mol_util_1.ValueCell.create(props.jumpLength), uTransform: gridTransform, uGridDim: gridDimension, dRenderMode: mol_util_1.ValueCell.create(props.renderMode.name), tTransferTex: transferTex, uTransferScale: mol_util_1.ValueCell.create(getTransferScale(props.stepsPerCell)), dGridTexType: mol_util_1.ValueCell.create(gridTexture.ref.value.getDepth() > 0 ? '3d' : '2d'), uGridTexDim: gridTextureDim, tGridTex: gridTexture, uGridStats: gridStats, uCellDim: directVolume.cellDim, uCartnToUnit: directVolume.cartnToUnit, uUnitToCartn: directVolume.unitToCartn, dPackedGroup: directVolume.packedGroup, dSingleLayer: mol_util_1.ValueCell.create(singleLayer), uDoubleSided: mol_util_1.ValueCell.create(props.doubleSided), dFlatShaded: mol_util_1.ValueCell.create(props.flatShaded), dFlipSided: mol_util_1.ValueCell.create(props.flipSided), dIgnoreLight: mol_util_1.ValueCell.create(props.ignoreLight), dXrayShaded: mol_util_1.ValueCell.create(props.xrayShaded) });
|
|
173
|
+
var controlPoints = (0, transfer_function_1.getControlPointsFromVec2Array)(props.controlPoints);
|
|
174
|
+
var transferTex = (0, transfer_function_1.createTransferFunctionTexture)(controlPoints);
|
|
175
|
+
return (0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)({ dGeometryType: mol_util_1.ValueCell.create('directVolume') }, color), marker), overpaint), transparency), material), clipping), transform), base_1.BaseGeometry.createValues(props, counts)), { aPosition: mol_util_1.ValueCell.create(VolumeBox.vertices), elements: mol_util_1.ValueCell.create(VolumeBox.indices), boundingSphere: mol_util_1.ValueCell.create(boundingSphere), invariantBoundingSphere: mol_util_1.ValueCell.create(invariantBoundingSphere), uInvariantBoundingSphere: mol_util_1.ValueCell.create(linear_algebra_1.Vec4.ofSphere(invariantBoundingSphere)), uBboxMin: bboxMin, uBboxMax: bboxMax, uBboxSize: bboxSize, uMaxSteps: mol_util_1.ValueCell.create(getMaxSteps(gridDimension.ref.value, props.stepsPerCell)), uStepScale: mol_util_1.ValueCell.create(getStepScale(directVolume.cellDim.ref.value, props.stepsPerCell)), uJumpLength: mol_util_1.ValueCell.create(props.jumpLength), uTransform: gridTransform, uGridDim: gridDimension, tTransferTex: transferTex, uTransferScale: mol_util_1.ValueCell.create(getTransferScale(props.stepsPerCell)), dGridTexType: mol_util_1.ValueCell.create(gridTexture.ref.value.getDepth() > 0 ? '3d' : '2d'), uGridTexDim: gridTextureDim, tGridTex: gridTexture, uGridStats: gridStats, uCellDim: directVolume.cellDim, uCartnToUnit: directVolume.cartnToUnit, uUnitToCartn: directVolume.unitToCartn, dPackedGroup: directVolume.packedGroup, dAxisOrder: mol_util_1.ValueCell.create(directVolume.axisOrder.ref.value.join('')), dIgnoreLight: mol_util_1.ValueCell.create(props.ignoreLight), dXrayShaded: mol_util_1.ValueCell.create(props.xrayShaded) });
|
|
211
176
|
}
|
|
212
177
|
function createValuesSimple(directVolume, props, colorValue, sizeValue, transform) {
|
|
213
178
|
var s = base_1.BaseGeometry.createSimple(colorValue, sizeValue, transform);
|
|
@@ -216,20 +181,10 @@ var DirectVolume;
|
|
|
216
181
|
}
|
|
217
182
|
function updateValues(values, props) {
|
|
218
183
|
base_1.BaseGeometry.updateValues(values, props);
|
|
219
|
-
mol_util_1.ValueCell.updateIfChanged(values.uDoubleSided, props.doubleSided);
|
|
220
|
-
mol_util_1.ValueCell.updateIfChanged(values.dFlatShaded, props.flatShaded);
|
|
221
|
-
mol_util_1.ValueCell.updateIfChanged(values.dFlipSided, props.flipSided);
|
|
222
184
|
mol_util_1.ValueCell.updateIfChanged(values.dIgnoreLight, props.ignoreLight);
|
|
223
185
|
mol_util_1.ValueCell.updateIfChanged(values.dXrayShaded, props.xrayShaded);
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
mol_util_1.ValueCell.updateIfChanged(values.uIsoValue, getNormalizedIsoValue(values.uIsoValue.ref.value, props.renderMode.params.isoValue, values.uGridStats.ref.value));
|
|
227
|
-
mol_util_1.ValueCell.updateIfChanged(values.dSingleLayer, props.renderMode.params.singleLayer);
|
|
228
|
-
}
|
|
229
|
-
else if (props.renderMode.name === 'volume') {
|
|
230
|
-
var controlPoints = (0, transfer_function_1.getControlPointsFromVec2Array)(props.renderMode.params.controlPoints);
|
|
231
|
-
(0, transfer_function_1.createTransferFunctionTexture)(controlPoints, props.renderMode.params.list.colors, values.tTransferTex);
|
|
232
|
-
}
|
|
186
|
+
var controlPoints = (0, transfer_function_1.getControlPointsFromVec2Array)(props.controlPoints);
|
|
187
|
+
(0, transfer_function_1.createTransferFunctionTexture)(controlPoints, values.tTransferTex);
|
|
233
188
|
mol_util_1.ValueCell.updateIfChanged(values.uMaxSteps, getMaxSteps(values.uGridDim.ref.value, props.stepsPerCell));
|
|
234
189
|
mol_util_1.ValueCell.updateIfChanged(values.uStepScale, getStepScale(values.uCellDim.ref.value, props.stepsPerCell));
|
|
235
190
|
mol_util_1.ValueCell.updateIfChanged(values.uTransferScale, getTransferScale(props.stepsPerCell));
|
|
@@ -249,13 +204,13 @@ var DirectVolume;
|
|
|
249
204
|
function createRenderableState(props) {
|
|
250
205
|
var state = base_1.BaseGeometry.createRenderableState(props);
|
|
251
206
|
state.opaque = false;
|
|
252
|
-
state.writeDepth =
|
|
207
|
+
state.writeDepth = false;
|
|
253
208
|
return state;
|
|
254
209
|
}
|
|
255
210
|
function updateRenderableState(state, props) {
|
|
256
211
|
base_1.BaseGeometry.updateRenderableState(state, props);
|
|
257
212
|
state.opaque = false;
|
|
258
|
-
state.writeDepth =
|
|
213
|
+
state.writeDepth = false;
|
|
259
214
|
}
|
|
260
215
|
})(DirectVolume = exports.DirectVolume || (exports.DirectVolume = {}));
|
|
261
216
|
//
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
2
|
+
* Copyright (c) 2018-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
3
3
|
*
|
|
4
4
|
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
|
5
5
|
*/
|
|
6
6
|
import { TextureImage } from '../../../mol-gl/renderable/util';
|
|
7
7
|
import { ValueCell } from '../../../mol-util';
|
|
8
8
|
import { Vec2 } from '../../../mol-math/linear-algebra';
|
|
9
|
-
import { ColorListName } from '../../../mol-util/color/lists';
|
|
10
|
-
import { ColorListEntry } from '../../../mol-util/color/color';
|
|
11
9
|
export interface ControlPoint {
|
|
12
10
|
x: number;
|
|
13
11
|
alpha: number;
|
|
14
12
|
}
|
|
15
13
|
export declare function getControlPointsFromString(s: string): ControlPoint[];
|
|
16
14
|
export declare function getControlPointsFromVec2Array(array: Vec2[]): ControlPoint[];
|
|
17
|
-
export declare function createTransferFunctionTexture(controlPoints: ControlPoint[],
|
|
15
|
+
export declare function createTransferFunctionTexture(controlPoints: ControlPoint[], texture?: ValueCell<TextureImage<Uint8Array>>): ValueCell<TextureImage<Uint8Array>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
3
|
+
* Copyright (c) 2018-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
4
4
|
*
|
|
5
5
|
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
|
6
6
|
*/
|
|
@@ -8,7 +8,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
8
8
|
exports.createTransferFunctionTexture = exports.getControlPointsFromVec2Array = exports.getControlPointsFromString = void 0;
|
|
9
9
|
var tslib_1 = require("tslib");
|
|
10
10
|
var interpolate_1 = require("../../../mol-math/interpolate");
|
|
11
|
-
var color_1 = require("../../../mol-util/color");
|
|
12
11
|
var mol_util_1 = require("../../../mol-util");
|
|
13
12
|
function getControlPointsFromString(s) {
|
|
14
13
|
return s.split(/\s*,\s*/).map(function (p) {
|
|
@@ -21,7 +20,7 @@ function getControlPointsFromVec2Array(array) {
|
|
|
21
20
|
return array.map(function (v) { return ({ x: v[0], alpha: v[1] }); });
|
|
22
21
|
}
|
|
23
22
|
exports.getControlPointsFromVec2Array = getControlPointsFromVec2Array;
|
|
24
|
-
function createTransferFunctionTexture(controlPoints,
|
|
23
|
+
function createTransferFunctionTexture(controlPoints, texture) {
|
|
25
24
|
var cp = (0, tslib_1.__spreadArray)((0, tslib_1.__spreadArray)([
|
|
26
25
|
{ x: 0, alpha: 0 },
|
|
27
26
|
{ x: 0, alpha: 0 }
|
|
@@ -29,9 +28,8 @@ function createTransferFunctionTexture(controlPoints, listOrName, texture) {
|
|
|
29
28
|
{ x: 1, alpha: 0 },
|
|
30
29
|
{ x: 1, alpha: 0 },
|
|
31
30
|
], false);
|
|
32
|
-
var scale = color_1.ColorScale.create({ domain: [0, 1], listOrName: listOrName });
|
|
33
31
|
var n = 256;
|
|
34
|
-
var array = texture ? texture.ref.value.array : new Uint8Array(n
|
|
32
|
+
var array = texture ? texture.ref.value.array : new Uint8Array(n);
|
|
35
33
|
var k = 0;
|
|
36
34
|
var x1, x2;
|
|
37
35
|
var a0, a1, a2, a3;
|
|
@@ -46,8 +44,7 @@ function createTransferFunctionTexture(controlPoints, listOrName, texture) {
|
|
|
46
44
|
var jl = Math.round((x2 - x1) * n);
|
|
47
45
|
for (var j = 0; j < jl; ++j) {
|
|
48
46
|
var t = j / jl;
|
|
49
|
-
array[k
|
|
50
|
-
scale.colorToArray(k / 255, array, k * 4);
|
|
47
|
+
array[k] = Math.max(0, (0, interpolate_1.spline)(a0, a1, a2, a3, t, 0.5) * 255);
|
|
51
48
|
++k;
|
|
52
49
|
}
|
|
53
50
|
}
|
|
@@ -117,7 +117,7 @@ var Image;
|
|
|
117
117
|
var counts = { drawCount: QuadIndices.length, vertexCount: util_3.QuadPositions.length / 3, groupCount: groupCount, instanceCount: instanceCount };
|
|
118
118
|
var invariantBoundingSphere = geometry_1.Sphere3D.clone(image.boundingSphere);
|
|
119
119
|
var boundingSphere = (0, util_2.calculateTransformBoundingSphere)(invariantBoundingSphere, transform.aTransform.ref.value, instanceCount);
|
|
120
|
-
return (0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)({}, color), marker), overpaint), transparency), material), clipping), transform), base_1.BaseGeometry.createValues(props, counts)), { aPosition: image.cornerBuffer, aUv: mol_util_1.ValueCell.create(QuadUvs), elements: mol_util_1.ValueCell.create(QuadIndices),
|
|
120
|
+
return (0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)({ dGeometryType: mol_util_1.ValueCell.create('image') }, color), marker), overpaint), transparency), material), clipping), transform), base_1.BaseGeometry.createValues(props, counts)), { aPosition: image.cornerBuffer, aUv: mol_util_1.ValueCell.create(QuadUvs), elements: mol_util_1.ValueCell.create(QuadIndices),
|
|
121
121
|
// aGroup is used as a vertex index here, group id is in tGroupTex
|
|
122
122
|
aGroup: mol_util_1.ValueCell.create((0, array_1.fillSerial)(new Float32Array(4))), boundingSphere: mol_util_1.ValueCell.create(boundingSphere), invariantBoundingSphere: mol_util_1.ValueCell.create(invariantBoundingSphere), uInvariantBoundingSphere: mol_util_1.ValueCell.create(linear_algebra_1.Vec4.ofSphere(invariantBoundingSphere)), dInterpolation: mol_util_1.ValueCell.create(props.interpolation), uImageTexDim: image.imageTextureDim, tImageTex: image.imageTexture, tGroupTex: image.groupTexture });
|
|
123
123
|
}
|
|
@@ -168,7 +168,7 @@ var Lines;
|
|
|
168
168
|
var counts = { drawCount: lines.lineCount * 2 * 3, vertexCount: lines.lineCount * 4, groupCount: groupCount, instanceCount: instanceCount };
|
|
169
169
|
var invariantBoundingSphere = geometry_1.Sphere3D.clone(lines.boundingSphere);
|
|
170
170
|
var boundingSphere = (0, util_2.calculateTransformBoundingSphere)(invariantBoundingSphere, transform.aTransform.ref.value, instanceCount);
|
|
171
|
-
return (0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)({ aMapping: lines.mappingBuffer, aGroup: lines.groupBuffer, aStart: lines.startBuffer, aEnd: lines.endBuffer, elements: lines.indexBuffer, boundingSphere: mol_util_1.ValueCell.create(boundingSphere), invariantBoundingSphere: mol_util_1.ValueCell.create(invariantBoundingSphere), uInvariantBoundingSphere: mol_util_1.ValueCell.create(linear_algebra_1.Vec4.ofSphere(invariantBoundingSphere)) }, color), size), marker), overpaint), transparency), material), clipping), transform), base_1.BaseGeometry.createValues(props, counts)), { uSizeFactor: mol_util_1.ValueCell.create(props.sizeFactor), dLineSizeAttenuation: mol_util_1.ValueCell.create(props.lineSizeAttenuation), uDoubleSided: mol_util_1.ValueCell.create(true), dFlipSided: mol_util_1.ValueCell.create(false) });
|
|
171
|
+
return (0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)({ dGeometryType: mol_util_1.ValueCell.create('lines'), aMapping: lines.mappingBuffer, aGroup: lines.groupBuffer, aStart: lines.startBuffer, aEnd: lines.endBuffer, elements: lines.indexBuffer, boundingSphere: mol_util_1.ValueCell.create(boundingSphere), invariantBoundingSphere: mol_util_1.ValueCell.create(invariantBoundingSphere), uInvariantBoundingSphere: mol_util_1.ValueCell.create(linear_algebra_1.Vec4.ofSphere(invariantBoundingSphere)) }, color), size), marker), overpaint), transparency), material), clipping), transform), base_1.BaseGeometry.createValues(props, counts)), { uSizeFactor: mol_util_1.ValueCell.create(props.sizeFactor), dLineSizeAttenuation: mol_util_1.ValueCell.create(props.lineSizeAttenuation), uDoubleSided: mol_util_1.ValueCell.create(true), dFlipSided: mol_util_1.ValueCell.create(false) });
|
|
172
172
|
}
|
|
173
173
|
function createValuesSimple(lines, props, colorValue, sizeValue, transform) {
|
|
174
174
|
var s = base_1.BaseGeometry.createSimple(colorValue, sizeValue, transform);
|
|
@@ -38,12 +38,20 @@ function getMarkersAverage(array, count) {
|
|
|
38
38
|
var viewEnd = (count - 4) >> 2;
|
|
39
39
|
var backStart = 4 * viewEnd;
|
|
40
40
|
var sum = 0;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
if (viewEnd < 0) {
|
|
42
|
+
// avoid edge cases with small arrays
|
|
43
|
+
for (var i = 0; i < count; ++i) {
|
|
44
|
+
sum += array[i] && 1;
|
|
45
|
+
}
|
|
44
46
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
else {
|
|
48
|
+
for (var i = 0; i < viewEnd; ++i) {
|
|
49
|
+
var v = view[i];
|
|
50
|
+
sum += MarkerCountLut[v & 0xFFFF] + MarkerCountLut[v >> 16];
|
|
51
|
+
}
|
|
52
|
+
for (var i = backStart; i < count; ++i) {
|
|
53
|
+
sum += array[i] && 1;
|
|
54
|
+
}
|
|
47
55
|
}
|
|
48
56
|
return sum / count;
|
|
49
57
|
}
|
|
@@ -596,7 +596,7 @@ var Mesh;
|
|
|
596
596
|
var counts = { drawCount: mesh.triangleCount * 3, vertexCount: mesh.vertexCount, groupCount: groupCount, instanceCount: instanceCount };
|
|
597
597
|
var invariantBoundingSphere = geometry_1.Sphere3D.clone(mesh.boundingSphere);
|
|
598
598
|
var boundingSphere = (0, util_3.calculateTransformBoundingSphere)(invariantBoundingSphere, transform.aTransform.ref.value, instanceCount);
|
|
599
|
-
return (0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)({ aPosition: mesh.vertexBuffer, aNormal: mesh.normalBuffer, aGroup: mesh.groupBuffer, elements: mesh.indexBuffer, boundingSphere: mol_util_1.ValueCell.create(boundingSphere), invariantBoundingSphere: mol_util_1.ValueCell.create(invariantBoundingSphere), uInvariantBoundingSphere: mol_util_1.ValueCell.create(linear_algebra_1.Vec4.ofSphere(invariantBoundingSphere)) }, color), marker), overpaint), transparency), material), clipping), transform), base_1.BaseGeometry.createValues(props, counts)), { uDoubleSided: mol_util_1.ValueCell.create(props.doubleSided), dFlatShaded: mol_util_1.ValueCell.create(props.flatShaded), dFlipSided: mol_util_1.ValueCell.create(props.flipSided), dIgnoreLight: mol_util_1.ValueCell.create(props.ignoreLight), dXrayShaded: mol_util_1.ValueCell.create(props.xrayShaded), uBumpFrequency: mol_util_1.ValueCell.create(props.bumpFrequency), uBumpAmplitude: mol_util_1.ValueCell.create(props.bumpAmplitude), meta: mol_util_1.ValueCell.create(mesh.meta) });
|
|
599
|
+
return (0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)({ dGeometryType: mol_util_1.ValueCell.create('mesh'), aPosition: mesh.vertexBuffer, aNormal: mesh.normalBuffer, aGroup: mesh.groupBuffer, elements: mesh.indexBuffer, boundingSphere: mol_util_1.ValueCell.create(boundingSphere), invariantBoundingSphere: mol_util_1.ValueCell.create(invariantBoundingSphere), uInvariantBoundingSphere: mol_util_1.ValueCell.create(linear_algebra_1.Vec4.ofSphere(invariantBoundingSphere)) }, color), marker), overpaint), transparency), material), clipping), transform), base_1.BaseGeometry.createValues(props, counts)), { uDoubleSided: mol_util_1.ValueCell.create(props.doubleSided), dFlatShaded: mol_util_1.ValueCell.create(props.flatShaded), dFlipSided: mol_util_1.ValueCell.create(props.flipSided), dIgnoreLight: mol_util_1.ValueCell.create(props.ignoreLight), dXrayShaded: mol_util_1.ValueCell.create(props.xrayShaded), uBumpFrequency: mol_util_1.ValueCell.create(props.bumpFrequency), uBumpAmplitude: mol_util_1.ValueCell.create(props.bumpAmplitude), meta: mol_util_1.ValueCell.create(mesh.meta) });
|
|
600
600
|
}
|
|
601
601
|
function createValuesSimple(mesh, props, colorValue, sizeValue, transform) {
|
|
602
602
|
var s = base_1.BaseGeometry.createSimple(colorValue, sizeValue, transform);
|
|
@@ -137,7 +137,7 @@ var Points;
|
|
|
137
137
|
var counts = { drawCount: points.pointCount, vertexCount: points.pointCount, groupCount: groupCount, instanceCount: instanceCount };
|
|
138
138
|
var invariantBoundingSphere = geometry_1.Sphere3D.clone(points.boundingSphere);
|
|
139
139
|
var boundingSphere = (0, util_2.calculateTransformBoundingSphere)(invariantBoundingSphere, transform.aTransform.ref.value, instanceCount);
|
|
140
|
-
return (0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)({ aPosition: points.centerBuffer, aGroup: points.groupBuffer, boundingSphere: mol_util_1.ValueCell.create(boundingSphere), invariantBoundingSphere: mol_util_1.ValueCell.create(invariantBoundingSphere), uInvariantBoundingSphere: mol_util_1.ValueCell.create(linear_algebra_1.Vec4.ofSphere(invariantBoundingSphere)) }, color), size), marker), overpaint), transparency), material), clipping), transform), base_1.BaseGeometry.createValues(props, counts)), { uSizeFactor: mol_util_1.ValueCell.create(props.sizeFactor), dPointSizeAttenuation: mol_util_1.ValueCell.create(props.pointSizeAttenuation), dPointStyle: mol_util_1.ValueCell.create(props.pointStyle) });
|
|
140
|
+
return (0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)({ dGeometryType: mol_util_1.ValueCell.create('points'), aPosition: points.centerBuffer, aGroup: points.groupBuffer, boundingSphere: mol_util_1.ValueCell.create(boundingSphere), invariantBoundingSphere: mol_util_1.ValueCell.create(invariantBoundingSphere), uInvariantBoundingSphere: mol_util_1.ValueCell.create(linear_algebra_1.Vec4.ofSphere(invariantBoundingSphere)) }, color), size), marker), overpaint), transparency), material), clipping), transform), base_1.BaseGeometry.createValues(props, counts)), { uSizeFactor: mol_util_1.ValueCell.create(props.sizeFactor), dPointSizeAttenuation: mol_util_1.ValueCell.create(props.pointSizeAttenuation), dPointStyle: mol_util_1.ValueCell.create(props.pointStyle) });
|
|
141
141
|
}
|
|
142
142
|
function createValuesSimple(points, props, colorValue, sizeValue, transform) {
|
|
143
143
|
var s = base_1.BaseGeometry.createSimple(colorValue, sizeValue, transform);
|
|
@@ -12,7 +12,7 @@ var linear_algebra_1 = require("../../mol-math/linear-algebra");
|
|
|
12
12
|
var util_1 = require("../../mol-gl/renderable/util");
|
|
13
13
|
var location_1 = require("../../mol-model/location");
|
|
14
14
|
var geometry_1 = require("./geometry");
|
|
15
|
-
var
|
|
15
|
+
var number_packing_1 = require("../../mol-util/number-packing");
|
|
16
16
|
function createSizes(locationIt, sizeTheme, sizeData) {
|
|
17
17
|
switch (geometry_1.Geometry.getGranularity(locationIt, sizeTheme.granularity)) {
|
|
18
18
|
case 'uniform': return createUniformSize(locationIt, sizeTheme.size, sizeData);
|
|
@@ -34,7 +34,7 @@ function getMaxSize(sizeData) {
|
|
|
34
34
|
var maxSize = 0;
|
|
35
35
|
var array = sizeData.tSize.ref.value.array;
|
|
36
36
|
for (var i = 0, il = array.length; i < il; i += 3) {
|
|
37
|
-
var value = (0,
|
|
37
|
+
var value = (0, number_packing_1.unpackRGBToInt)(array[i], array[i + 1], array[i + 2]);
|
|
38
38
|
if (maxSize < value)
|
|
39
39
|
maxSize = value;
|
|
40
40
|
}
|
|
@@ -89,7 +89,7 @@ function createInstanceSize(locationIt, sizeFn, sizeData) {
|
|
|
89
89
|
locationIt.reset();
|
|
90
90
|
while (locationIt.hasNext && !locationIt.isNextNewInstance) {
|
|
91
91
|
var v = locationIt.move();
|
|
92
|
-
(0,
|
|
92
|
+
(0, number_packing_1.packIntToRGBArray)(sizeFn(v.location) * exports.sizeDataFactor, sizes.array, v.instanceIndex * 3);
|
|
93
93
|
locationIt.skipInstance();
|
|
94
94
|
}
|
|
95
95
|
return createTextureSize(sizes, 'instance', sizeData);
|
|
@@ -102,7 +102,7 @@ function createGroupSize(locationIt, sizeFn, sizeData) {
|
|
|
102
102
|
locationIt.reset();
|
|
103
103
|
while (locationIt.hasNext && !locationIt.isNextNewInstance) {
|
|
104
104
|
var v = locationIt.move();
|
|
105
|
-
(0,
|
|
105
|
+
(0, number_packing_1.packIntToRGBArray)(sizeFn(v.location) * exports.sizeDataFactor, sizes.array, v.groupIndex * 3);
|
|
106
106
|
}
|
|
107
107
|
return createTextureSize(sizes, 'group', sizeData);
|
|
108
108
|
}
|
|
@@ -115,7 +115,7 @@ function createGroupInstanceSize(locationIt, sizeFn, sizeData) {
|
|
|
115
115
|
locationIt.reset();
|
|
116
116
|
while (locationIt.hasNext) {
|
|
117
117
|
var v = locationIt.move();
|
|
118
|
-
(0,
|
|
118
|
+
(0, number_packing_1.packIntToRGBArray)(sizeFn(v.location) * exports.sizeDataFactor, sizes.array, v.index * 3);
|
|
119
119
|
}
|
|
120
120
|
return createTextureSize(sizes, 'groupInstance', sizeData);
|
|
121
121
|
}
|
|
@@ -135,7 +135,7 @@ var Spheres;
|
|
|
135
135
|
var padding = spheres.boundingSphere.radius ? (0, size_data_1.getMaxSize)(size) * props.sizeFactor : 0;
|
|
136
136
|
var invariantBoundingSphere = geometry_1.Sphere3D.expand((0, geometry_1.Sphere3D)(), spheres.boundingSphere, padding);
|
|
137
137
|
var boundingSphere = (0, util_1.calculateTransformBoundingSphere)(invariantBoundingSphere, transform.aTransform.ref.value, instanceCount);
|
|
138
|
-
return (0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)({ aPosition: spheres.centerBuffer, aMapping: spheres.mappingBuffer, aGroup: spheres.groupBuffer, elements: spheres.indexBuffer, boundingSphere: mol_util_1.ValueCell.create(boundingSphere), invariantBoundingSphere: mol_util_1.ValueCell.create(invariantBoundingSphere), uInvariantBoundingSphere: mol_util_1.ValueCell.create(linear_algebra_1.Vec4.ofSphere(invariantBoundingSphere)) }, color), size), marker), overpaint), transparency), material), clipping), transform), { padding: mol_util_1.ValueCell.create(padding) }), base_1.BaseGeometry.createValues(props, counts)), { uSizeFactor: mol_util_1.ValueCell.create(props.sizeFactor), uDoubleSided: mol_util_1.ValueCell.create(props.doubleSided), dIgnoreLight: mol_util_1.ValueCell.create(props.ignoreLight), dXrayShaded: mol_util_1.ValueCell.create(props.xrayShaded), uBumpFrequency: mol_util_1.ValueCell.create(props.bumpFrequency), uBumpAmplitude: mol_util_1.ValueCell.create(props.bumpAmplitude) });
|
|
138
|
+
return (0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)({ dGeometryType: mol_util_1.ValueCell.create('spheres'), aPosition: spheres.centerBuffer, aMapping: spheres.mappingBuffer, aGroup: spheres.groupBuffer, elements: spheres.indexBuffer, boundingSphere: mol_util_1.ValueCell.create(boundingSphere), invariantBoundingSphere: mol_util_1.ValueCell.create(invariantBoundingSphere), uInvariantBoundingSphere: mol_util_1.ValueCell.create(linear_algebra_1.Vec4.ofSphere(invariantBoundingSphere)) }, color), size), marker), overpaint), transparency), material), clipping), transform), { padding: mol_util_1.ValueCell.create(padding) }), base_1.BaseGeometry.createValues(props, counts)), { uSizeFactor: mol_util_1.ValueCell.create(props.sizeFactor), uDoubleSided: mol_util_1.ValueCell.create(props.doubleSided), dIgnoreLight: mol_util_1.ValueCell.create(props.ignoreLight), dXrayShaded: mol_util_1.ValueCell.create(props.xrayShaded), uBumpFrequency: mol_util_1.ValueCell.create(props.bumpFrequency), uBumpAmplitude: mol_util_1.ValueCell.create(props.bumpAmplitude) });
|
|
139
139
|
}
|
|
140
140
|
function createValuesSimple(spheres, props, colorValue, sizeValue, transform) {
|
|
141
141
|
var s = base_1.BaseGeometry.createSimple(colorValue, sizeValue, transform);
|
|
@@ -151,7 +151,7 @@ var Text;
|
|
|
151
151
|
var padding = getPadding(text.mappingBuffer.ref.value, text.depthBuffer.ref.value, text.charCount, (0, size_data_1.getMaxSize)(size));
|
|
152
152
|
var invariantBoundingSphere = geometry_1.Sphere3D.expand((0, geometry_1.Sphere3D)(), text.boundingSphere, padding);
|
|
153
153
|
var boundingSphere = (0, util_1.calculateTransformBoundingSphere)(invariantBoundingSphere, transform.aTransform.ref.value, instanceCount);
|
|
154
|
-
return (0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)({ aPosition: text.centerBuffer, aMapping: text.mappingBuffer, aDepth: text.depthBuffer, aGroup: text.groupBuffer, elements: text.indexBuffer, boundingSphere: mol_util_1.ValueCell.create(boundingSphere), invariantBoundingSphere: mol_util_1.ValueCell.create(invariantBoundingSphere), uInvariantBoundingSphere: mol_util_1.ValueCell.create(linear_algebra_1.Vec4.ofSphere(invariantBoundingSphere)) }, color), size), marker), overpaint), transparency), substance), clipping), transform), { aTexCoord: text.tcoordBuffer, tFont: text.fontTexture, padding: mol_util_1.ValueCell.create(padding) }), base_1.BaseGeometry.createValues(props, counts)), { uSizeFactor: mol_util_1.ValueCell.create(props.sizeFactor), uBorderWidth: mol_util_1.ValueCell.create((0, interpolate_1.clamp)(props.borderWidth, 0, 0.5)), uBorderColor: mol_util_1.ValueCell.create(color_1.Color.toArrayNormalized(props.borderColor, linear_algebra_1.Vec3.zero(), 0)), uOffsetX: mol_util_1.ValueCell.create(props.offsetX), uOffsetY: mol_util_1.ValueCell.create(props.offsetY), uOffsetZ: mol_util_1.ValueCell.create(props.offsetZ), uBackgroundColor: mol_util_1.ValueCell.create(color_1.Color.toArrayNormalized(props.backgroundColor, linear_algebra_1.Vec3.zero(), 0)), uBackgroundOpacity: mol_util_1.ValueCell.create(props.backgroundOpacity) });
|
|
154
|
+
return (0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)({ dGeometryType: mol_util_1.ValueCell.create('text'), aPosition: text.centerBuffer, aMapping: text.mappingBuffer, aDepth: text.depthBuffer, aGroup: text.groupBuffer, elements: text.indexBuffer, boundingSphere: mol_util_1.ValueCell.create(boundingSphere), invariantBoundingSphere: mol_util_1.ValueCell.create(invariantBoundingSphere), uInvariantBoundingSphere: mol_util_1.ValueCell.create(linear_algebra_1.Vec4.ofSphere(invariantBoundingSphere)) }, color), size), marker), overpaint), transparency), substance), clipping), transform), { aTexCoord: text.tcoordBuffer, tFont: text.fontTexture, padding: mol_util_1.ValueCell.create(padding) }), base_1.BaseGeometry.createValues(props, counts)), { uSizeFactor: mol_util_1.ValueCell.create(props.sizeFactor), uBorderWidth: mol_util_1.ValueCell.create((0, interpolate_1.clamp)(props.borderWidth, 0, 0.5)), uBorderColor: mol_util_1.ValueCell.create(color_1.Color.toArrayNormalized(props.borderColor, linear_algebra_1.Vec3.zero(), 0)), uOffsetX: mol_util_1.ValueCell.create(props.offsetX), uOffsetY: mol_util_1.ValueCell.create(props.offsetY), uOffsetZ: mol_util_1.ValueCell.create(props.offsetZ), uBackgroundColor: mol_util_1.ValueCell.create(color_1.Color.toArrayNormalized(props.backgroundColor, linear_algebra_1.Vec3.zero(), 0)), uBackgroundOpacity: mol_util_1.ValueCell.create(props.backgroundOpacity) });
|
|
155
155
|
}
|
|
156
156
|
function createValuesSimple(text, props, colorValue, sizeValue, transform) {
|
|
157
157
|
var s = base_1.BaseGeometry.createSimple(colorValue, sizeValue, transform);
|
|
@@ -113,7 +113,7 @@ var TextureMesh;
|
|
|
113
113
|
var counts = { drawCount: textureMesh.vertexCount, vertexCount: textureMesh.vertexCount, groupCount: groupCount, instanceCount: instanceCount };
|
|
114
114
|
var invariantBoundingSphere = geometry_1.Sphere3D.clone(textureMesh.boundingSphere);
|
|
115
115
|
var boundingSphere = (0, util_1.calculateTransformBoundingSphere)(invariantBoundingSphere, transform.aTransform.ref.value, instanceCount);
|
|
116
|
-
return (0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)({ uGeoTexDim: textureMesh.geoTextureDim, tPosition: textureMesh.vertexTexture, tGroup: textureMesh.groupTexture, tNormal: textureMesh.normalTexture, boundingSphere: mol_util_1.ValueCell.create(boundingSphere), invariantBoundingSphere: mol_util_1.ValueCell.create(invariantBoundingSphere), uInvariantBoundingSphere: mol_util_1.ValueCell.create(linear_algebra_1.Vec4.ofSphere(invariantBoundingSphere)) }, color), marker), overpaint), transparency), substance), clipping), transform), base_1.BaseGeometry.createValues(props, counts)), { uDoubleSided: mol_util_1.ValueCell.create(props.doubleSided), dFlatShaded: mol_util_1.ValueCell.create(props.flatShaded), dFlipSided: mol_util_1.ValueCell.create(props.flipSided), dIgnoreLight: mol_util_1.ValueCell.create(props.ignoreLight), dXrayShaded: mol_util_1.ValueCell.create(props.xrayShaded), uBumpFrequency: mol_util_1.ValueCell.create(props.bumpFrequency), uBumpAmplitude: mol_util_1.ValueCell.create(props.bumpAmplitude),
|
|
116
|
+
return (0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)({ dGeometryType: mol_util_1.ValueCell.create('textureMesh'), uGeoTexDim: textureMesh.geoTextureDim, tPosition: textureMesh.vertexTexture, tGroup: textureMesh.groupTexture, tNormal: textureMesh.normalTexture, boundingSphere: mol_util_1.ValueCell.create(boundingSphere), invariantBoundingSphere: mol_util_1.ValueCell.create(invariantBoundingSphere), uInvariantBoundingSphere: mol_util_1.ValueCell.create(linear_algebra_1.Vec4.ofSphere(invariantBoundingSphere)) }, color), marker), overpaint), transparency), substance), clipping), transform), base_1.BaseGeometry.createValues(props, counts)), { uDoubleSided: mol_util_1.ValueCell.create(props.doubleSided), dFlatShaded: mol_util_1.ValueCell.create(props.flatShaded), dFlipSided: mol_util_1.ValueCell.create(props.flipSided), dIgnoreLight: mol_util_1.ValueCell.create(props.ignoreLight), dXrayShaded: mol_util_1.ValueCell.create(props.xrayShaded), uBumpFrequency: mol_util_1.ValueCell.create(props.bumpFrequency), uBumpAmplitude: mol_util_1.ValueCell.create(props.bumpAmplitude), meta: mol_util_1.ValueCell.create(textureMesh.meta) });
|
|
117
117
|
}
|
|
118
118
|
function createValuesSimple(textureMesh, props, colorValue, sizeValue, transform) {
|
|
119
119
|
var s = base_1.BaseGeometry.createSimple(colorValue, sizeValue, transform);
|
|
@@ -12,7 +12,7 @@ var render_item_1 = require("../../webgl/render-item");
|
|
|
12
12
|
var schema_1 = require("../../renderable/schema");
|
|
13
13
|
var shader_code_1 = require("../../../mol-gl/shader-code");
|
|
14
14
|
var mol_util_1 = require("../../../mol-util");
|
|
15
|
-
var
|
|
15
|
+
var number_packing_1 = require("../../../mol-util/number-packing");
|
|
16
16
|
var util_1 = require("../util");
|
|
17
17
|
var quad_vert_1 = require("../../../mol-gl/shader/quad.vert");
|
|
18
18
|
var sum_frag_1 = require("../../../mol-gl/shader/histogram-pyramid/sum.frag");
|
|
@@ -73,7 +73,7 @@ function getHistopyramidSum(ctx, pyramidTopTexture) {
|
|
|
73
73
|
ctx.unbindFramebuffer();
|
|
74
74
|
return (0, compat_1.isWebGL2)(gl)
|
|
75
75
|
? sumInts[0]
|
|
76
|
-
: (0,
|
|
76
|
+
: (0, number_packing_1.unpackRGBToInt)(sumBytes[0], sumBytes[1], sumBytes[2]);
|
|
77
77
|
}
|
|
78
78
|
exports.getHistopyramidSum = getHistopyramidSum;
|
|
79
79
|
//# sourceMappingURL=sum.js.map
|
|
@@ -7,7 +7,7 @@ import { WebGLContext } from '../../webgl/context';
|
|
|
7
7
|
import { Texture } from '../../../mol-gl/webgl/texture';
|
|
8
8
|
import { Vec3, Vec2, Mat4 } from '../../../mol-math/linear-algebra';
|
|
9
9
|
import { HistogramPyramid } from '../histogram-pyramid/reduction';
|
|
10
|
-
export declare function createIsosurfaceBuffers(ctx: WebGLContext, activeVoxelsBase: Texture, volumeData: Texture, histogramPyramid: HistogramPyramid, gridDim: Vec3, gridTexDim: Vec3, transform: Mat4, isoValue: number, invert: boolean, packedGroup: boolean, vertexTexture?: Texture, groupTexture?: Texture, normalTexture?: Texture): {
|
|
10
|
+
export declare function createIsosurfaceBuffers(ctx: WebGLContext, activeVoxelsBase: Texture, volumeData: Texture, histogramPyramid: HistogramPyramid, gridDim: Vec3, gridTexDim: Vec3, transform: Mat4, isoValue: number, invert: boolean, packedGroup: boolean, axisOrder: Vec3, vertexTexture?: Texture, groupTexture?: Texture, normalTexture?: Texture): {
|
|
11
11
|
vertexTexture: Texture;
|
|
12
12
|
groupTexture: Texture;
|
|
13
13
|
normalTexture: Texture;
|
|
@@ -22,7 +22,7 @@ export declare function createIsosurfaceBuffers(ctx: WebGLContext, activeVoxelsB
|
|
|
22
22
|
*
|
|
23
23
|
* Implementation based on http://www.miaumiau.cat/2016/10/stream-compaction-in-webgl/
|
|
24
24
|
*/
|
|
25
|
-
export declare function extractIsosurface(ctx: WebGLContext, volumeData: Texture, gridDim: Vec3, gridTexDim: Vec3, gridTexScale: Vec2, transform: Mat4, isoValue: number, invert: boolean, packedGroup: boolean, vertexTexture?: Texture, groupTexture?: Texture, normalTexture?: Texture): {
|
|
25
|
+
export declare function extractIsosurface(ctx: WebGLContext, volumeData: Texture, gridDim: Vec3, gridTexDim: Vec3, gridTexScale: Vec2, transform: Mat4, isoValue: number, invert: boolean, packedGroup: boolean, axisOrder: Vec3, vertexTexture?: Texture, groupTexture?: Texture, normalTexture?: Texture): {
|
|
26
26
|
vertexTexture: Texture;
|
|
27
27
|
groupTexture: Texture;
|
|
28
28
|
normalTexture: Texture;
|
|
@@ -19,9 +19,9 @@ var quad_vert_1 = require("../../../mol-gl/shader/quad.vert");
|
|
|
19
19
|
var isosurface_frag_1 = require("../../../mol-gl/shader/marching-cubes/isosurface.frag");
|
|
20
20
|
var active_voxels_1 = require("./active-voxels");
|
|
21
21
|
var compat_1 = require("../../webgl/compat");
|
|
22
|
-
var IsosurfaceSchema = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, util_1.QuadSchema), { tTriIndices: (0, schema_1.TextureSpec)('image-uint8', 'alpha', 'ubyte', 'nearest'), tActiveVoxelsPyramid: (0, schema_1.TextureSpec)('texture', 'rgba', 'float', 'nearest'), tActiveVoxelsBase: (0, schema_1.TextureSpec)('texture', 'rgba', 'float', 'nearest'), tVolumeData: (0, schema_1.TextureSpec)('texture', 'rgba', 'ubyte', 'nearest'), uIsoValue: (0, schema_1.UniformSpec)('f'), uSize: (0, schema_1.UniformSpec)('f'), uLevels: (0, schema_1.UniformSpec)('f'), uCount: (0, schema_1.UniformSpec)('f'), uInvert: (0, schema_1.UniformSpec)('b'), uGridDim: (0, schema_1.UniformSpec)('v3'), uGridTexDim: (0, schema_1.UniformSpec)('v3'), uGridTransform: (0, schema_1.UniformSpec)('m4'), uScale: (0, schema_1.UniformSpec)('v2'), dPackedGroup: (0, schema_1.DefineSpec)('boolean') });
|
|
22
|
+
var IsosurfaceSchema = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, util_1.QuadSchema), { tTriIndices: (0, schema_1.TextureSpec)('image-uint8', 'alpha', 'ubyte', 'nearest'), tActiveVoxelsPyramid: (0, schema_1.TextureSpec)('texture', 'rgba', 'float', 'nearest'), tActiveVoxelsBase: (0, schema_1.TextureSpec)('texture', 'rgba', 'float', 'nearest'), tVolumeData: (0, schema_1.TextureSpec)('texture', 'rgba', 'ubyte', 'nearest'), uIsoValue: (0, schema_1.UniformSpec)('f'), uSize: (0, schema_1.UniformSpec)('f'), uLevels: (0, schema_1.UniformSpec)('f'), uCount: (0, schema_1.UniformSpec)('f'), uInvert: (0, schema_1.UniformSpec)('b'), uGridDim: (0, schema_1.UniformSpec)('v3'), uGridTexDim: (0, schema_1.UniformSpec)('v3'), uGridTransform: (0, schema_1.UniformSpec)('m4'), uScale: (0, schema_1.UniformSpec)('v2'), dPackedGroup: (0, schema_1.DefineSpec)('boolean'), dAxisOrder: (0, schema_1.DefineSpec)('string', ['012', '021', '102', '120', '201', '210']) });
|
|
23
23
|
var IsosurfaceName = 'isosurface';
|
|
24
|
-
function getIsosurfaceRenderable(ctx, activeVoxelsPyramid, activeVoxelsBase, volumeData, gridDim, gridTexDim, transform, isoValue, levels, scale, count, invert, packedGroup) {
|
|
24
|
+
function getIsosurfaceRenderable(ctx, activeVoxelsPyramid, activeVoxelsBase, volumeData, gridDim, gridTexDim, transform, isoValue, levels, scale, count, invert, packedGroup, axisOrder) {
|
|
25
25
|
if (ctx.namedComputeRenderables[IsosurfaceName]) {
|
|
26
26
|
var v = ctx.namedComputeRenderables[IsosurfaceName].values;
|
|
27
27
|
mol_util_1.ValueCell.update(v.tActiveVoxelsPyramid, activeVoxelsPyramid);
|
|
@@ -37,16 +37,17 @@ function getIsosurfaceRenderable(ctx, activeVoxelsPyramid, activeVoxelsBase, vol
|
|
|
37
37
|
mol_util_1.ValueCell.update(v.uGridTransform, transform);
|
|
38
38
|
mol_util_1.ValueCell.update(v.uScale, scale);
|
|
39
39
|
mol_util_1.ValueCell.update(v.dPackedGroup, packedGroup);
|
|
40
|
+
mol_util_1.ValueCell.updateIfChanged(v.dAxisOrder, axisOrder.join(''));
|
|
40
41
|
ctx.namedComputeRenderables[IsosurfaceName].update();
|
|
41
42
|
}
|
|
42
43
|
else {
|
|
43
|
-
ctx.namedComputeRenderables[IsosurfaceName] = createIsosurfaceRenderable(ctx, activeVoxelsPyramid, activeVoxelsBase, volumeData, gridDim, gridTexDim, transform, isoValue, levels, scale, count, invert, packedGroup);
|
|
44
|
+
ctx.namedComputeRenderables[IsosurfaceName] = createIsosurfaceRenderable(ctx, activeVoxelsPyramid, activeVoxelsBase, volumeData, gridDim, gridTexDim, transform, isoValue, levels, scale, count, invert, packedGroup, axisOrder);
|
|
44
45
|
}
|
|
45
46
|
return ctx.namedComputeRenderables[IsosurfaceName];
|
|
46
47
|
}
|
|
47
|
-
function createIsosurfaceRenderable(ctx, activeVoxelsPyramid, activeVoxelsBase, volumeData, gridDim, gridTexDim, transform, isoValue, levels, scale, count, invert, packedGroup) {
|
|
48
|
+
function createIsosurfaceRenderable(ctx, activeVoxelsPyramid, activeVoxelsBase, volumeData, gridDim, gridTexDim, transform, isoValue, levels, scale, count, invert, packedGroup, axisOrder) {
|
|
48
49
|
// console.log('uSize', Math.pow(2, levels))
|
|
49
|
-
var values = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, util_1.QuadValues), { tTriIndices: mol_util_1.ValueCell.create((0, tables_1.getTriIndices)()), tActiveVoxelsPyramid: mol_util_1.ValueCell.create(activeVoxelsPyramid), tActiveVoxelsBase: mol_util_1.ValueCell.create(activeVoxelsBase), tVolumeData: mol_util_1.ValueCell.create(volumeData), uIsoValue: mol_util_1.ValueCell.create(isoValue), uSize: mol_util_1.ValueCell.create(Math.pow(2, levels)), uLevels: mol_util_1.ValueCell.create(levels), uCount: mol_util_1.ValueCell.create(count), uInvert: mol_util_1.ValueCell.create(invert), uGridDim: mol_util_1.ValueCell.create(gridDim), uGridTexDim: mol_util_1.ValueCell.create(gridTexDim), uGridTransform: mol_util_1.ValueCell.create(transform), uScale: mol_util_1.ValueCell.create(scale), dPackedGroup: mol_util_1.ValueCell.create(packedGroup) });
|
|
50
|
+
var values = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, util_1.QuadValues), { tTriIndices: mol_util_1.ValueCell.create((0, tables_1.getTriIndices)()), tActiveVoxelsPyramid: mol_util_1.ValueCell.create(activeVoxelsPyramid), tActiveVoxelsBase: mol_util_1.ValueCell.create(activeVoxelsBase), tVolumeData: mol_util_1.ValueCell.create(volumeData), uIsoValue: mol_util_1.ValueCell.create(isoValue), uSize: mol_util_1.ValueCell.create(Math.pow(2, levels)), uLevels: mol_util_1.ValueCell.create(levels), uCount: mol_util_1.ValueCell.create(count), uInvert: mol_util_1.ValueCell.create(invert), uGridDim: mol_util_1.ValueCell.create(gridDim), uGridTexDim: mol_util_1.ValueCell.create(gridTexDim), uGridTransform: mol_util_1.ValueCell.create(transform), uScale: mol_util_1.ValueCell.create(scale), dPackedGroup: mol_util_1.ValueCell.create(packedGroup), dAxisOrder: mol_util_1.ValueCell.create(axisOrder.join('')) });
|
|
50
51
|
var schema = (0, tslib_1.__assign)({}, IsosurfaceSchema);
|
|
51
52
|
var shaderCode = (0, shader_code_1.ShaderCode)('isosurface', quad_vert_1.quad_vert, isosurface_frag_1.isosurface_frag, { drawBuffers: 'required' });
|
|
52
53
|
var renderItem = (0, render_item_1.createComputeRenderItem)(ctx, 'triangles', shaderCode, schema, values);
|
|
@@ -62,7 +63,7 @@ function setRenderingDefaults(ctx) {
|
|
|
62
63
|
state.colorMask(true, true, true, true);
|
|
63
64
|
state.clearColor(0, 0, 0, 0);
|
|
64
65
|
}
|
|
65
|
-
function createIsosurfaceBuffers(ctx, activeVoxelsBase, volumeData, histogramPyramid, gridDim, gridTexDim, transform, isoValue, invert, packedGroup, vertexTexture, groupTexture, normalTexture) {
|
|
66
|
+
function createIsosurfaceBuffers(ctx, activeVoxelsBase, volumeData, histogramPyramid, gridDim, gridTexDim, transform, isoValue, invert, packedGroup, axisOrder, vertexTexture, groupTexture, normalTexture) {
|
|
66
67
|
var drawBuffers = ctx.extensions.drawBuffers;
|
|
67
68
|
if (!drawBuffers)
|
|
68
69
|
throw new Error('need WebGL draw buffers');
|
|
@@ -110,7 +111,7 @@ function createIsosurfaceBuffers(ctx, activeVoxelsBase, volumeData, histogramPyr
|
|
|
110
111
|
vertexTexture.attachFramebuffer(framebuffer, 0);
|
|
111
112
|
groupTexture.attachFramebuffer(framebuffer, 1);
|
|
112
113
|
normalTexture.attachFramebuffer(framebuffer, 2);
|
|
113
|
-
var renderable = getIsosurfaceRenderable(ctx, pyramidTex, activeVoxelsBase, volumeData, gridDim, gridTexDim, transform, isoValue, levels, scale, count, invert, packedGroup);
|
|
114
|
+
var renderable = getIsosurfaceRenderable(ctx, pyramidTex, activeVoxelsBase, volumeData, gridDim, gridTexDim, transform, isoValue, levels, scale, count, invert, packedGroup, axisOrder);
|
|
114
115
|
ctx.state.currentRenderItemId = -1;
|
|
115
116
|
framebuffer.bind();
|
|
116
117
|
drawBuffers.drawBuffers([
|
|
@@ -136,7 +137,7 @@ exports.createIsosurfaceBuffers = createIsosurfaceBuffers;
|
|
|
136
137
|
*
|
|
137
138
|
* Implementation based on http://www.miaumiau.cat/2016/10/stream-compaction-in-webgl/
|
|
138
139
|
*/
|
|
139
|
-
function extractIsosurface(ctx, volumeData, gridDim, gridTexDim, gridTexScale, transform, isoValue, invert, packedGroup, vertexTexture, groupTexture, normalTexture) {
|
|
140
|
+
function extractIsosurface(ctx, volumeData, gridDim, gridTexDim, gridTexScale, transform, isoValue, invert, packedGroup, axisOrder, vertexTexture, groupTexture, normalTexture) {
|
|
140
141
|
// console.time('calcActiveVoxels');
|
|
141
142
|
var activeVoxelsTex = (0, active_voxels_1.calcActiveVoxels)(ctx, volumeData, gridDim, gridTexDim, isoValue, gridTexScale);
|
|
142
143
|
// ctx.waitForGpuCommandsCompleteSync();
|
|
@@ -146,7 +147,7 @@ function extractIsosurface(ctx, volumeData, gridDim, gridTexDim, gridTexScale, t
|
|
|
146
147
|
// ctx.waitForGpuCommandsCompleteSync();
|
|
147
148
|
// console.timeEnd('createHistogramPyramid');
|
|
148
149
|
// console.time('createIsosurfaceBuffers');
|
|
149
|
-
var gv = createIsosurfaceBuffers(ctx, activeVoxelsTex, volumeData, compacted, gridDim, gridTexDim, transform, isoValue, invert, packedGroup, vertexTexture, groupTexture, normalTexture);
|
|
150
|
+
var gv = createIsosurfaceBuffers(ctx, activeVoxelsTex, volumeData, compacted, gridDim, gridTexDim, transform, isoValue, invert, packedGroup, axisOrder, vertexTexture, groupTexture, normalTexture);
|
|
150
151
|
// ctx.waitForGpuCommandsCompleteSync();
|
|
151
152
|
// console.timeEnd('createIsosurfaceBuffers');
|
|
152
153
|
return gv;
|
|
@@ -92,6 +92,7 @@ export declare const CylindersSchema: {
|
|
|
92
92
|
tColorGrid: import("./schema").TextureSpec<"texture">;
|
|
93
93
|
dColorType: DefineSpec<"string">;
|
|
94
94
|
dUsePalette: DefineSpec<"boolean">;
|
|
95
|
+
dGeometryType: DefineSpec<"string">;
|
|
95
96
|
};
|
|
96
97
|
export declare type CylindersSchema = typeof CylindersSchema;
|
|
97
98
|
export declare type CylindersValues = Values<CylindersSchema>;
|