molstar
Version:
A comprehensive macromolecular library.
24 lines (22 loc) • 765 B
JavaScript
"use strict";
/**
* Copyright (c) 2018 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.read_from_texture = void 0;
exports.read_from_texture = `
vec4 readFromTexture(const in sampler2D tex, const in float i, const in vec2 dim) {
float x = intMod(i, dim.x);
float y = floor(intDiv(i, dim.x));
vec2 uv = (vec2(x, y) + 0.5) / dim;
return texture2D(tex, uv);
}
vec4 readFromTexture(const in sampler2D tex, const in int i, const in vec2 dim) {
int x = imod(i, int(dim.x));
int y = i / int(dim.x);
vec2 uv = (vec2(x, y) + 0.5) / dim;
return texture2D(tex, uv);
}
`;