First commit of the starter kit.
This commit is contained in:
parent
20dc00e62f
commit
612ad717c0
42 changed files with 1853 additions and 0 deletions
18
assets/shaders/ui_error.frag
Normal file
18
assets/shaders/ui_error.frag
Normal file
|
@ -0,0 +1,18 @@
|
|||
uniform vec2 u_resolution;
|
||||
uniform vec2 u_mouse;
|
||||
uniform float u_duration;
|
||||
uniform float u_time;
|
||||
uniform float u_time_end;
|
||||
uniform sampler2D texture;
|
||||
uniform bool is_shape;
|
||||
|
||||
void main() {
|
||||
if(is_shape) {
|
||||
vec4 color = vec4(1.0, 0.0, 0.0, 1.0);
|
||||
gl_FragColor = gl_Color * color;
|
||||
} else {
|
||||
vec4 pixel = texture2D(texture, gl_TexCoord[0].xy);
|
||||
vec4 color = vec4(1.0, 0.0, 0.0, 1.0);
|
||||
gl_FragColor = gl_Color * color * pixel;
|
||||
}
|
||||
}
|
29
assets/shaders/ui_shader.frag
Normal file
29
assets/shaders/ui_shader.frag
Normal file
|
@ -0,0 +1,29 @@
|
|||
uniform vec2 u_resolution;
|
||||
uniform vec2 u_mouse;
|
||||
uniform float u_duration;
|
||||
uniform float u_time;
|
||||
uniform float u_time_end;
|
||||
uniform sampler2D texture;
|
||||
uniform bool is_shape;
|
||||
uniform bool hover;
|
||||
|
||||
vec4 blink() {
|
||||
if(hover) {
|
||||
return vec4(0.95, 0.95, 1.0, 1.0);
|
||||
} else {
|
||||
float tick = (u_time_end - u_time) / u_duration;
|
||||
float blink = mix(0.5, 1.0, tick);
|
||||
return vec4(blink, blink, blink, 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec4 color = blink();
|
||||
|
||||
if(!is_shape) {
|
||||
vec4 pixel = texture2D(texture, gl_TexCoord[0].xy);
|
||||
color *= pixel;
|
||||
}
|
||||
|
||||
gl_FragColor = gl_Color * color;
|
||||
}
|
12
assets/shaders/ui_shape_shader.frag
Normal file
12
assets/shaders/ui_shape_shader.frag
Normal file
|
@ -0,0 +1,12 @@
|
|||
uniform vec2 u_resolution;
|
||||
uniform vec2 u_mouse;
|
||||
uniform float u_duration;
|
||||
uniform float u_time;
|
||||
uniform float u_time_end;
|
||||
|
||||
void main() {
|
||||
float tick = (u_time_end - u_time) / u_duration;
|
||||
float blink = smoothstep(1.0, 0.5, tick);
|
||||
vec4 color = vec4(blink, blink, blink, 1.0);
|
||||
gl_FragColor = gl_Color * color;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue