molstar
Version:
A comprehensive macromolecular library.
61 lines (54 loc) • 1.59 kB
JavaScript
"use strict";
/**
* Copyright (c) 2018-2025 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.mesh_vert = void 0;
exports.mesh_vert = `
precision highp float;
precision highp int;
precision highp sampler2D;
uniform vec2 uGeoTexDim;
uniform sampler2D tPosition;
uniform sampler2D tGroup;
uniform sampler2D tNormal;
attribute vec3 aPosition;
attribute float aGroup;
attribute vec3 aNormal;
attribute mat4 aTransform;
attribute float aInstance;
varying vec3 vNormal;
void main(){
int vertexId = VertexID;
vec3 normal = readFromTexture(tNormal, vertexId, uGeoTexDim).xyz;
vec3 normal = aNormal;
mat3 normalMatrix = adjoint(modelView);
vec3 transformedNormal = normalize(normalMatrix * normalize(normal));
if (!uDoubleSided) { // TODO checking uDoubleSided should not be required, ASR
transformedNormal = -transformedNormal;
}
vNormal = transformedNormal;
}
`;