basic: added nightsky; utilities: added random

This commit is contained in:
2017-06-08 22:00:05 -04:00
parent 0ef75170b3
commit 6a7e322957
2 changed files with 35 additions and 0 deletions

30
basic/nightsky.glsl Normal file
View File

@@ -0,0 +1,30 @@
#ifdef GL_ES
precision mediump float;
#endif
#define PI 3.14159265358979323846
uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform float u_time;
float random (in vec2 _st) {
return fract(sin(dot(_st.xy,
vec2(12.9898,78.233)))*
43758.5453123);
}
float line(vec2 st, float pct) {
return smoothstep( pct-0.02, pct, st.y) -
smoothstep( pct, pct+0.02, st.y);
}
void main() {
vec2 st = gl_FragCoord.xy/u_resolution.xy;
float color = 0.;
color = line(st, random(st));
gl_FragColor = vec4(vec3(color),1.0);
}

5
utilities/random.glsl Normal file
View File

@@ -0,0 +1,5 @@
float random(vec2 st) {
return fract(sin(dot(st.xy,
vec2(12.9898,78.233)))*
43758.5453123);
}