molstar
Version:
A comprehensive macromolecular library.
42 lines • 1.47 kB
JavaScript
/**
* Copyright (c) 2019 mol* contributors, licensed under MIT, See LICENSE file for more info.
*
* @author Alexander Rose <alexander.rose@weirdbyte.de>
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.getTriIndices = exports.getTriCount = void 0;
var tables_1 = require("../../../mol-geo/util/marching-cubes/tables");
var util_1 = require("../../../mol-gl/renderable/util");
var TriCount;
function getTriCount() {
if (TriCount !== undefined)
return TriCount;
TriCount = (0, util_1.createTextureImage)(16 * 16, 1, Uint8Array);
var array = TriCount.array;
for (var i = 0, il = tables_1.TriTable.length; i < il; ++i) {
array[i] = tables_1.TriTable[i].length / 3;
}
return TriCount;
}
exports.getTriCount = getTriCount;
var TriIndices;
function getTriIndices() {
if (TriIndices !== undefined)
return TriIndices;
TriIndices = (0, util_1.createTextureImage)(64 * 64, 1, Uint8Array);
var array = TriIndices.array;
for (var i = 0, il = tables_1.TriTable.length; i < il; ++i) {
for (var j = 0; j < 16; ++j) {
if (j < tables_1.TriTable[i].length) {
array[i * 16 + j] = tables_1.TriTable[i][j];
}
else {
array[i * 16 + j] = 255;
}
}
}
return TriIndices;
}
exports.getTriIndices = getTriIndices;
//# sourceMappingURL=tables.js.map
;