basic: added nightsky; utilities: added random
This commit is contained in:
30
basic/nightsky.glsl
Normal file
30
basic/nightsky.glsl
Normal 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
5
utilities/random.glsl
Normal file
@@ -0,0 +1,5 @@
|
||||
float random(vec2 st) {
|
||||
return fract(sin(dot(st.xy,
|
||||
vec2(12.9898,78.233)))*
|
||||
43758.5453123);
|
||||
}
|
Reference in New Issue
Block a user