solvespace/res/shaders/mesh.frag
whitequark c8ff17f4a2 Add OpenGL 2 support on Windows using ANGLE.
This commit performs two main changes:
  * Alters the shaders to use only strictly conformant GLSL 2.0.
  * Alters the Windows UI to use ANGLE via GL ES 2.0 and EGL 1.4.

This commit also drops official support for Windows XP, since ANGLE
requires a non-XP toolset to build. It is still possible to build
SolveSpace for Windows XP using:

  cmake -T v120_xp -DOPENGL=1
2016-11-18 11:38:45 +00:00

27 lines
809 B
GLSL

//-----------------------------------------------------------------------------
// SolveSpace Mesh rendering shader
//
// Copyright 2016 Aleksey Egorov
//-----------------------------------------------------------------------------
uniform vec3 lightDir0;
uniform vec3 lightDir1;
uniform float lightInt0;
uniform float lightInt1;
uniform float ambient;
varying vec3 fragNormal;
varying vec4 fragColor;
void main() {
vec3 result = fragColor.xyz * ambient;
vec3 normal = normalize(fragNormal);
float light0 = clamp(dot(lightDir0, normal), 0.0, 1.0) * lightInt0 * (1.0 - ambient);
result += fragColor.rgb * light0;
float light1 = clamp(dot(lightDir1, normal), 0.0, 1.0) * lightInt1 * (1.0 - ambient);
result += fragColor.rgb * light1;
gl_FragColor = vec4(result, fragColor.a);
}