GLSL smoothstep is NOT lerp, it's 'Hermite linear interpolation' which basically means not a damn thing anyone says it is. mix is what I want.
This commit is contained in:
parent
766b20f3f8
commit
08bc48df3d
2 changed files with 3 additions and 3 deletions
|
@ -9,13 +9,13 @@ uniform bool is_shape;
|
||||||
void main() {
|
void main() {
|
||||||
if(is_shape) {
|
if(is_shape) {
|
||||||
float tick = (u_time_end - u_time) / u_duration;
|
float tick = (u_time_end - u_time) / u_duration;
|
||||||
float blink = smoothstep(1.0, 0.5, tick);
|
float blink = mix(0.5, 1.0, tick);
|
||||||
vec4 color = vec4(blink, blink, blink, 1.0);
|
vec4 color = vec4(blink, blink, blink, 1.0);
|
||||||
gl_FragColor = gl_Color * color;
|
gl_FragColor = gl_Color * color;
|
||||||
} else {
|
} else {
|
||||||
vec4 pixel = texture2D(texture, gl_TexCoord[0].xy);
|
vec4 pixel = texture2D(texture, gl_TexCoord[0].xy);
|
||||||
float tick = (u_time_end - u_time) / u_duration;
|
float tick = (u_time_end - u_time) / u_duration;
|
||||||
float blink = smoothstep(1.0, 0.5, tick);
|
float blink = mix(0.5, 1.0, tick);
|
||||||
vec4 color = vec4(blink, blink, blink, 1.0);
|
vec4 color = vec4(blink, blink, blink, 1.0);
|
||||||
gl_FragColor = gl_Color * color * pixel;
|
gl_FragColor = gl_Color * color * pixel;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace gui {
|
||||||
$gui.set<Sprite>(button, {"leather_pouch-128"});
|
$gui.set<Sprite>(button, {"leather_pouch-128"});
|
||||||
// $gui.set<Rectangle>(button, {});
|
// $gui.set<Rectangle>(button, {});
|
||||||
$gui.set<Label>(button, {label});
|
$gui.set<Label>(button, {label});
|
||||||
$gui.set<Shader>(button, {.duration=0.2f});
|
$gui.set<Shader>(button, {.duration=0.1f});
|
||||||
$gui.set<Clickable>(button,
|
$gui.set<Clickable>(button,
|
||||||
guecs::make_action(*$level.world, event));
|
guecs::make_action(*$level.world, event));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue