Bunch of visual fixes

main
Cameron Murphy Reikes 2 years ago
parent 53afb37e52
commit 7ec58bea5a

@ -14,6 +14,7 @@ uniform sampler2D iChannel0;
uniform uniforms {
int is_colorless; // if greater than zero, no color
float target_hue;
float alpha;
};
in vec2 texUV;
out vec4 fragColor;
@ -47,17 +48,19 @@ vec3 hsv2rgb(vec3 c)
void main() {
vec4 outColor = texture2DAA(iChannel0, texUV);
outColor.a *= alpha;
vec3 hsv = rgb2hsv(outColor.rgb);
float green_hue = 118.0f / 360.0f;
if(abs(hsv.r - green_hue) < 0.15) {
if(is_colorless > 0)
{
hsv.y = 0.0f;
} else {
float green_hue = 118.0f / 360.0f;
if(abs(hsv.r - green_hue) < 0.15) {
hsv.x = target_hue;
}
}
fragColor = vec4(hsv2rgb(hsv), outColor.a);
}
@end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 406 B

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 488 B

After

Width:  |  Height:  |  Size: 9.4 KiB

@ -761,6 +761,7 @@ static void setup_hueshift(enum Squad squad)
hueshift_uniforms_t uniform = {
.is_colorless = meta.is_colorless,
.target_hue = (float)meta.hue,
.alpha = sgp_get_color().a,
};
sgp_set_uniform(&uniform, sizeof(hueshift_uniforms_t));
}
@ -1142,6 +1143,7 @@ static void ui(bool draw, double dt, double width, double height)
pipeline_scope(hueshift_pipeline)
{
set_color(WHITE);
setup_hueshift(this_squad);
rotate_at(flag_rot[i], flag_pos[i].x, flag_pos[i].y);
@ -1940,23 +1942,6 @@ static void frame(void)
}
sgp_reset_image(0);
if (b->box_type == BoxMissileLauncher)
{
set_color(RED);
draw_circle(entity_pos(b), MISSILE_RANGE);
// draw the charging missile
transform_scope
{
rotate_at(missile_launcher_target(&gs, b).facing_angle, entity_pos(b).x, entity_pos(b).y);
set_color_values(1.0, 1.0, 1.0, b->missile_construction_charge);
sgp_set_image(0, image_missile);
pipeline_scope(goodpixel_pipeline)
draw_texture_centered(entity_pos(b), BOX_SIZE);
sgp_reset_image(0);
}
}
if (b->box_type == BoxScanner)
{
sgp_set_image(0, image_scanner_head);
@ -2004,6 +1989,25 @@ static void frame(void)
draw_line(entity_pos(b).x, entity_pos(b).y, to.x, to.y);
}
}
if (b->box_type == BoxMissileLauncher)
{
set_color(RED);
draw_circle(entity_pos(b), MISSILE_RANGE);
// draw the charging missile
transform_scope
{
rotate_at(missile_launcher_target(&gs, b).facing_angle, entity_pos(b).x, entity_pos(b).y);
sgp_set_image(0, image_missile);
pipeline_scope(hueshift_pipeline)
{
set_color_values(1.0, 1.0, 1.0, b->missile_construction_charge);
setup_hueshift(b->owning_squad);
draw_texture_centered(entity_pos(b), BOX_SIZE);
}
sgp_reset_image(0);
}
}
}
}
@ -2024,9 +2028,14 @@ static void frame(void)
sgp_set_image(0, image_missile);
}
pipeline_scope(goodpixel_pipeline)
pipeline_scope(hueshift_pipeline)
{
setup_hueshift(e->owning_squad);
draw_texture_rectangle_centered(entity_pos(e), MISSILE_SPRITE_SIZE);
}
sgp_reset_image(0);
}
}
// draw player

Loading…
Cancel
Save