-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnormal.frag
More file actions
29 lines (24 loc) · 731 Bytes
/
Copy pathnormal.frag
File metadata and controls
29 lines (24 loc) · 731 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* shader.frag
* -----------
* Fragment shader used for all rendering. */
precision highp float;
varying vec3 vNormal;
varying vec2 vTexcoord0;
varying float vLight;
uniform sampler2D uTex0;
uniform float uTime;
uniform vec4 uColor;
void main (void) {
gl_FragColor = texture2D (uTex0, vec2 (vTexcoord0.s, vTexcoord0.t))
* uColor;
/* crystal-like colors and refraction. */
#if 0
float t = uTime * 0.125;
gl_FragColor.rgb *= mix (vec3 (vLight, vLight, vLight), vec3 (
sin ((vLight + 0.00 + t) * 3.141 * 4.00) * 0.50 + 0.50,
sin ((vLight + 0.33 + t) * 3.141 * 4.00) * 0.50 + 0.50,
sin ((vLight + 0.66 + t) * 3.141 * 4.00) * 0.50 + 0.50), 0.50);
#else
gl_FragColor.rgb *= vLight;
#endif
}