molstar
Version:
A comprehensive macromolecular library.
80 lines (68 loc) • 2.27 kB
JavaScript
/**
* Copyright (c) 2018-2025 mol* contributors, licensed under MIT, See LICENSE file for more info.
*
* @author Alexander Rose <alexander.rose@weirdbyte.de>
*/
export const mesh_frag = `
precision highp float;
precision highp int;
uniform vec4 uInteriorColor;
uniform vec4 uInteriorSubstance;
void main() {
interior = !gl_FrontFacing;
float fragmentDepth = gl_FragCoord.z;
vec3 fdx = dFdx(vViewPosition);
vec3 fdy = dFdy(vViewPosition);
vec3 normal = -normalize(cross(fdx,fdy));
vec3 normal = -normalize(vNormal);
if (uDoubleSided) normal *= float(gl_FrontFacing) * 2.0 - 1.0;
normal *= -1.0;
gl_FragColor = vObject;
gl_FragData[1] = vInstance;
gl_FragData[2] = vGroup;
gl_FragData[3] = packDepthToRGBA(fragmentDepth);
gl_FragColor = vColor;
gl_FragColor = material;
gl_FragColor = material;
gl_FragColor = material;
gl_FragData[1] = vec4(normal, emissive);
gl_FragData[2] = vec4(material.rgb, uDensity);
}
`;