diff --git a/basic/nightsky.glsl b/basic/nightsky.glsl new file mode 100644 index 0000000..0c22412 --- /dev/null +++ b/basic/nightsky.glsl @@ -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); +} diff --git a/utilities/random.glsl b/utilities/random.glsl new file mode 100644 index 0000000..e1e1b00 --- /dev/null +++ b/utilities/random.glsl @@ -0,0 +1,5 @@ +float random(vec2 st) { + return fract(sin(dot(st.xy, + vec2(12.9898,78.233)))* + 43758.5453123); +}