versustunez
9d5259767c
- fixed loading songs - cleanup utils - added some helper class - cleanup preparing of WEBGL2 - added 3D wave - added light-support - added configs - added gui-events for playing, shuffling and playlist
26 lines
667 B
GLSL
26 lines
667 B
GLSL
#version 300 es
|
|
|
|
// fragment shaders don't have a default precision so we need
|
|
// to pick one. mediump is a good default. It means "medium precision"
|
|
precision mediump float;
|
|
|
|
in vec4 pos;
|
|
in vec3 v_surfaceToLight;
|
|
uniform vec4 u_color;
|
|
|
|
out vec4 outColor;
|
|
|
|
void main() {
|
|
vec4 fragNormal = normalize(pos);
|
|
float u_light = 0.3;
|
|
float light = max(dot(fragNormal.xyz, normalize(v_surfaceToLight).xyz), u_light);
|
|
vec3 baseColor = vec3(0, 0, 1);
|
|
vec3 maxColor = vec3(1, 0, 0);
|
|
float y = pos.z;
|
|
if (y < 0.0) {
|
|
y = y * -1.0;
|
|
}
|
|
vec3 color = mix(baseColor, maxColor, y);
|
|
outColor = vec4(color, 1.0);
|
|
outColor.rgb *= light;
|
|
} |