background shader render progress, replacing shape renderers with texture (haven't created said textures yet)

This commit is contained in:
2017-06-10 12:34:08 -05:00
parent d036900399
commit cf07c14f86
11 changed files with 106 additions and 75 deletions

View File

@@ -3,10 +3,10 @@ attribute vec4 a_color;
attribute vec2 a_texCoord0;
uniform mat4 u_projTrans;
uniform vec2 mouse;
varying vec4 vColor;
varying vec2 vTexCoord;
void main() {
vColor = a_color;
vTexCoord = a_texCoord0;

View File

@@ -1,11 +1,10 @@
#extension GL_OES_standard_derivatives : enable
uniform float time;
uniform vec2 mouse;
uniform vec2 resolution;
varying float vTime;
varying vec2 vResolution;
#define M_PI 3.1415926535897932384626433832795
//#define time (time * time * 0.05)
//#define vTime (vTime * vTime * 0.05)
vec2 rand2(vec2 p)
{
@@ -44,9 +43,9 @@ float stars(in vec2 x, float numCells, float size, float br)
void main()
{
float res = max(resolution.y, resolution.y);
float res = max(vResolution.y, vResolution.y);
vec2 coord = gl_FragCoord.xy / resolution;
vec2 coord = gl_FragCoord.xy / vResolution;
vec2 tmp = coord;
@@ -54,13 +53,13 @@ void main()
coord.y = tmp.x;
vec3 result = vec3(0.);
result += stars(vec2(coord.x + time * 2.00,coord.y) , 1., 0.10, 2.) * vec3(.74, .74, .74);
result += stars(vec2(coord.x + time * 1.10,coord.y) , 1., 0.10, 2.) * vec3(.74, .74, .74);
result += stars(vec2(coord.x + time * 0.8,coord.y) , 1., 0.10, 2.) * vec3(.74, .74, .74);
result += stars(vec2(coord.x + time * 0.5,coord.y) , 2., 0.09, 2.) * vec3(.74, .74, .74);
result += stars(vec2(coord.x + time * 0.2,coord.y) , 4., 0.08, 2.) * vec3(.74, .74, .74);
result += stars(vec2(coord.x + time * 0.05,coord.y), 8., 0.05, 1.) * vec3(.74, .74, .74);
result += stars(vec2(coord.x + time * 0.025,coord.y), 10., 0.05,0.8) * vec3(.95, .95, .95);
result += stars(vec2(coord.x + vTime * 2.00,coord.y) , 1., 0.10, 2.) * vec3(.74, .74, .74);
result += stars(vec2(coord.x + vTime * 1.10,coord.y) , 1., 0.10, 2.) * vec3(.74, .74, .74);
result += stars(vec2(coord.x + vTime * 0.8,coord.y) , 1., 0.10, 2.) * vec3(.74, .74, .74);
result += stars(vec2(coord.x + vTime * 0.5,coord.y) , 2., 0.09, 2.) * vec3(.74, .74, .74);
result += stars(vec2(coord.x + vTime * 0.2,coord.y) , 4., 0.08, 2.) * vec3(.74, .74, .74);
result += stars(vec2(coord.x + vTime * 0.05,coord.y), 8., 0.05, 1.) * vec3(.74, .74, .74);
result += stars(vec2(coord.x + vTime * 0.025,coord.y), 10., 0.05,0.8) * vec3(.95, .95, .95);
result += stars(coord , 20., 0.025, 0.5) * vec3(.9, .9, .95);
@@ -70,9 +69,9 @@ void main()
// bar layer open scene ;
// vec2 bl = gl_FragCoord.xy / resolution.xy;
// vec2 bl = gl_FragCoord.xy / vResolution.xy;
// if(bl.y>.50-min(time/20.,0.4) ^^ bl.y<0.50+min(time/20.0,.4)) gl_FragColor = vec4(0.0,sqrt(coord.y+0.1),0.3,1.0);
// if(bl.y>.50-min(vTime/20.,0.4) ^^ bl.y<0.50+min(vTime/20.0,.4)) gl_FragColor = vec4(0.0,sqrt(coord.y+0.1),0.3,1.0);

View File

@@ -0,0 +1,20 @@
attribute vec4 a_position;
attribute vec4 a_color;
attribute vec2 a_texCoord0;
uniform mat4 u_projTrans;
uniform float time;
uniform vec2 resolution;
varying vec4 vColor;
varying vec2 vTexCoord;
varying float vTime;
varying vec2 vResolution;
void main() {
vColor = a_color;
vTexCoord = a_texCoord0;
vTime = time;
vResolution = resolution;
gl_Position = u_projTrans * a_position;
}