molstar
Version:
A comprehensive macromolecular library.
45 lines • 2.24 kB
JavaScript
/**
* Copyright (c) 2018-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
*
* @author Alexander Rose <alexander.rose@weirdbyte.de>
*/
import { __awaiter, __generator } from "tslib";
import { GaussianDensityTexture2d, GaussianDensityTexture3d } from './gaussian-density/gpu';
import { Task } from '../../mol-task/task';
import { GaussianDensityCPU } from './gaussian-density/cpu';
export var DefaultGaussianDensityProps = {
resolution: 1,
radiusOffset: 0,
smoothness: 1.5,
};
export function computeGaussianDensity(position, box, radius, props) {
var _this = this;
return Task.create('Gaussian Density', function (ctx) { return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, GaussianDensityCPU(ctx, position, box, radius, props)];
case 1: return [2 /*return*/, _a.sent()];
}
});
}); });
}
export function computeGaussianDensityTexture(position, box, radius, props, webgl, texture) {
return _computeGaussianDensityTexture(webgl.isWebGL2 ? '3d' : '2d', position, box, radius, props, webgl, texture);
}
export function computeGaussianDensityTexture2d(position, box, radius, props, webgl, texture) {
return _computeGaussianDensityTexture('2d', position, box, radius, props, webgl, texture);
}
export function computeGaussianDensityTexture3d(position, box, radius, props, webgl, texture) {
return _computeGaussianDensityTexture('2d', position, box, radius, props, webgl, texture);
}
function _computeGaussianDensityTexture(type, position, box, radius, props, webgl, texture) {
var _this = this;
return Task.create('Gaussian Density', function (ctx) { return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, type === '2d' ?
GaussianDensityTexture2d(webgl, position, box, radius, false, props, texture) :
GaussianDensityTexture3d(webgl, position, box, radius, props, texture)];
});
}); });
}
//# sourceMappingURL=gaussian-density.js.map