parent
c5cb8373ab
commit
11679c2ffd
@ -0,0 +1,22 @@
|
||||
//SpriteBatch will use texture unit 0
|
||||
uniform sampler2D u_texture;
|
||||
uniform vec2 u_screenResolution;
|
||||
|
||||
//"in" varyings from our vertex shader
|
||||
varying vec4 vColor;
|
||||
varying vec2 vTexCoord;
|
||||
void main() {
|
||||
//sample the texture
|
||||
vec4 texColor = texture2D(u_texture, vTexCoord);
|
||||
float dx = u_screenResolution.x / 2.0 - gl_FragCoord.x;
|
||||
float dy = u_screenResolution.y / 2.0 - gl_FragCoord.y;
|
||||
float dxi = u_screenResolution.x / 2.0;
|
||||
float dyi = u_screenResolution.y / 2.0;
|
||||
float dis = sqrt(dx * dx + dy * dy);
|
||||
float disFull = sqrt(dxi * dxi + dyi * dyi);
|
||||
float disSq = (1-(dis / disFull));
|
||||
texColor.rgb = texColor.rgb * disSq * disSq * disSq * disSq * disSq;
|
||||
|
||||
//final color
|
||||
gl_FragColor = texColor * vColor;
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
attribute vec4 a_position;
|
||||
attribute vec4 a_color;
|
||||
attribute vec2 a_texCoord0;
|
||||
|
||||
uniform mat4 u_projTrans;
|
||||
|
||||
varying vec4 vColor;
|
||||
varying vec2 vTexCoord;
|
||||
varying vec2 vScreenPos;
|
||||
|
||||
void main() {
|
||||
vColor = a_color;
|
||||
vTexCoord = a_texCoord0;
|
||||
gl_Position = u_projTrans * a_position;
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue