vec3 lightPos = {x: 0, y: 2, z: 0}; vec4 vertexShader( in attr!(vec3, `positions`) inPos, in attr!(vec3, `normals`) inNorm, in attr!(vec3, `texCoords`) inTC, out vec3 toLight, out vec3 norm, out vec3 toEye) { static if (compute) { inNorm = modelMat.rotate(inNorm); norm = inNorm; toLight = lightPos - modelMat.xform(inPos); toLight.normalize(); toEye = viewerPosition - modelMat.xform(inPos); toEye.normalize(); return comboMat.xform(vec4(inPos.x, inPos.y, inPos.z, 1)); } else return vec4.zero; } void pixelShader( in vec3 toLight, in vec3 inNorm, in vec3 toEye, out Color output) { static if (compute) { toLight.normalize(); inNorm.normalize(); toEye.normalize(); float normDotLight = inNorm.dot(toLight); vec3 refl = 2f * (normDotLight) * inNorm - toLight; float fresnel = 1f + toEye.dot(inNorm); fresnel *= fresnel; fresnel = 1f / (fresnel * fresnel); if (fresnel > 0.7) fresnel = 0.7; output = float3ToColor(0, 0, fresnel); }}